The following code causes a segfault: struct SomeStruct(T) { T _value; //If removed, there is no segfault. alias _value this; } //If removed or replaced with an actual //function template, there is no segfault. template doSomething(T: ulong) {} void doSomething(T: SomeStruct!T)() { assert(false); } pragma(msg, doSomething!(SomeStruct!ulong)()); According to GDB: Program received signal SIGSEGV, Segmentation fault. 0x0000000000562cfd in TypeInstance::deduceType (this=0x8e55d0, sc=0x98b300, tparam=0x8e13c0, parameters=0x8e50a0, dedtypes=0x7fffffffd4c0, wildmatch=0x0) at template.c:3621 3621 TemplateDeclaration *tempdecl = tempinst->tempdecl->isTemplateDeclaration();
This (somewhat less strange) example also makes DMD segfault at the same place: struct SomeStruct(T) { T _value; alias _value this; } void doSomething(T: ulong)() { assert(false); } void doSomething(T: string)() { assert(false); } void doSomething(T: SomeStruct!T)() { assert(false); } pragma(msg, doSomething!(SomeStruct!ulong)());
*** This issue has been marked as a duplicate of issue 11518 ***