dmd segfaults

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 31 10:01:22 PDT 2014


matovitch:

> Does anybody knows why dmd segfaults on this code ? Should I 
> report this as a bug ?

Please report this minimized case to Bugzilla:


struct Foo(int[] arr) {
     const int[] arr = arr;
}
void main() {
     Foo!([0]) foo;
}


The error it gives before the crash:

test.d(2,17): Deprecation: variable test.Foo!([0]).Foo.arr const 
field with initializer should be static, __gshared, or an enum


The cause of the crash if that the local variable has the same 
name as the template argument, combined with the reported error.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list