[Issue 16565] New: Implementing an interface with preconditions causes segfault
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Sep 29 05:18:37 PDT 2016
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 at puremagic.com
Reporter: belka at 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.
--
More information about the Digitalmars-d-bugs
mailing list