https://d.puremagic.com/issues/show_bug.cgi?id=11835
Summary: Assert not thrown from contract Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: chalu...@gmail.com --- Comment #0 from Tomáš Chaloupka <chalu...@gmail.com> 2013-12-27 23:24:57 PST --- With code like this: import std.stdio; import core.exception; import std.exception; interface IFoo { void test() in { writeln("IFoo.test"); assert(false); } } class Foo : IFoo { abstract void test() in { writeln("Foo.test"); } body{} } class Bar : Foo { override void test() { writeln("Bar.test"); } } unittest { auto bar = new Bar(); assertThrown!AssertError(bar.test()); } I expected, that AssertError should be thrown from interface contract, but only Bar.test is called. With modification: class Bar : Foo { override void test() in { writeln("Bar.test"); } body{} } Foo.test is called this time (Bar.test is not), but AssertError is still not thrown so assertThrown fails. With further modification: class Foo : IFoo { abstract void test() in { writeln("Foo.test"); assert(false); } body{} } Output is: Foo.test IFoo.test Bar.test core.exception.AssertError@source/app.d(45): assertThrown failed: No AssertError was thrown. So this time all contracts are called but still no AssertError thrown. With this modification: class Bar : Foo { override void test() in { writeln("Bar.test"); assert(false); } body{} } All contracts are called and AssertError is thrown from Bar.test(). I think that this is a bug related to 6856 but as it seems that even AssertErrors are somehow "eaten" somewhere, I filled this bug so it can be checked too. Tested with DMD 2.064.2 on Gentoo linux -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------