Bug 11190 – DMD segfaults in template resolution with "alias this"

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-07T10:13:00Z
Last change time
2013-11-21T18:32:46Z
Keywords
ice
Assigned to
nobody
Creator
blm768

Comments

Comment #0 by blm768 — 2013-10-07T10:13:58Z
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();
Comment #1 by blm768 — 2013-10-07T10:25:57Z
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)());
Comment #2 by k.hara.pg — 2013-11-21T18:32:46Z
*** This issue has been marked as a duplicate of issue 11518 ***