Here is a reduced test case. Compiles and runs fine with dmd-2.053, segfaults at compile stage for dmd 1.054. Compiles and runs fine with dmd-2.054 if I take out "size_t N" template parameter. Also compiles fine with 2.054 if printFoo is defined outside the main function. import std.stdio; struct Foo(IF, size_t N) {} interface Bar {} void main() { void printFoo(T: Foo!(IF, N), IF, size_t N)(T foo) if(is(IF == interface)) { writeln("Type: ", T.stringof); } Foo!(Bar, 1) foo; printFoo(foo); }
Simplified code: struct Foo(int N) {} void main() { void bar(T: Foo!(N), int N)(T) {} }
DMD pull #242. https://github.com/D-Programming-Language/dmd/pull/242
(In reply to comment #2) > DMD pull #242. > > https://github.com/D-Programming-Language/dmd/pull/242 That was fast :-) A limited form of typestate (see bug 4571 ) might help D user code avoid many null reference bugs.
(In reply to comment #3) > (In reply to comment #2) > > DMD pull #242. > > > > https://github.com/D-Programming-Language/dmd/pull/242 > > That was fast :-) > > A limited form of typestate (see bug 4571 ) might help D user code avoid many > null reference bugs. Typestates in D cannot help NULL dereferencing bugs in DMD which is written in C++.
https://github.com/D-Programming-Language/dmd/commit/1dac08b77af2826996567f629acf7f43d724cd48