In dmd 2.039, the following code fails to pass the in-contract. class Base { void method() {} } class Derived : Base { void method() in { assert(false); } body {} } void main() { Base b = new Derived; b.method(); } But, according to the spec, IIUC, it should successfully pass the check. > A function without an in contract means that any values of the function parameters are allowed. This implies that if any function in an inheritance hierarchy has no in contract, then in contracts on functions overriding it have no useful effect. If I add an explicit empty in-contract to Base.method: void method() in{} body{} then it passes the check.
https://github.com/D-Programming-Language/dmd/pull/192
https://github.com/D-Programming-Language/dmd/commit/1de48286f27eeb58231ab033d35385f06bf0e578 https://github.com/D-Programming-Language/dmd/commit/f2722bf1b96c024141698edfb01894578590a546
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル