digitalmars.D.bugs - [Issue 16565] New: Implementing an interface with preconditions
- via Digitalmars-d-bugs (49/49) Sep 29 2016 https://issues.dlang.org/show_bug.cgi?id=16565
https://issues.dlang.org/show_bug.cgi?id=16565 Issue ID: 16565 Summary: Implementing an interface with preconditions causes segfault Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: belka caraus.de 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. --
Sep 29 2016