The following causes dmd to segfault: import std.traits; interface BarBase { void do_a_thing(); } interface Bar(T) : BarBase { static if(hasMember!(T, "rotation") && is(typeof(T.rotation) == double)) { @property double rotation(); final void do_a_thing() { //do a thing with rotation; } } else { final void do_a_thing() { //do a thing without rotation; } } } class Foo1 : Bar!Foo1 { } class Foo2 : Bar!Foo2 { @property double rotation() { return 1.0; }; } This code is theoretically compilable because if it were changed to imitate the halting problem then: if the function is declared final then there isn't a conflict, if it isn't then the class has to be abstract.
Segfault doesn't occur with git-head (2.067alpha), and the code reports following errors: test.d(10): Error: expression hasMember!(Foo1, "rotation") of type void does not have a boolean value test.d(10): Error: template instance std.traits.hasMember!(Foo1, "rotation") error instantiating test.d(28): instantiated from here: Bar!(Foo1) test.d(10): Error: expression hasMember!(Foo2, "rotation") of type void does not have a boolean value test.d(10): Error: template instance std.traits.hasMember!(Foo2, "rotation") error instantiating test.d(32): instantiated from here: Bar!(Foo2) Remove "segfault" word from the subject.
Running the example on dmd 2.078.0 Ubuntu 16.04 results in : test.d(27): Error: class `test.Foo1` interface function void do_a_thing() is not implemented test.d(31): Error: class `test.Foo2` interface function void do_a_thing() is not implemented test.d(31): Error: class `test.Foo2` interface function double rotation() @property is not implemented So the real problem here is this: (reduced test case) interface A { void x(); } interface B : A { final void x() { } } class C : B { //override void x() {} } If the method in C is commented you will get error stating that you are not implementing x. If you uncomment you will get an error stating that you cannot override final method. That's the real bug. Changing the title to reflect that
Moving this to issue 16306, since that issue contains less noise and has a perfect example in the first comment. *** This issue has been marked as a duplicate of issue 16306 ***