If I compile the following program (Naughty.d): interface Foo { public void delegate() add(Object[] elements) in { foreach (el; elements) {} } } class FooImpl : Foo { public void delegate() add(Object[] elements) in { } body { return null; } } void main() { FooImpl bar = new FooImpl; bar.add(new Object[2]); } and run it I get a Segmentation fault. Compile command: dmd -gc -w Naughty.d -L--export-dynamic DMD version: DMD64 D Compiler v2.071.2 The segfault happens apparently in the foreach-loop, in the precondition of Foo.add(). It crashes before the first execution of the loop body. I also had similar errors when putting invariants in some classes or interfaces.
*** This issue has been marked as a duplicate of issue 15984 ***