www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13921] New: ICE with template instantiation error

https://issues.dlang.org/show_bug.cgi?id=13921

          Issue ID: 13921
           Summary: ICE with template instantiation error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: sinkuupump gmail.com

Compiler crashes with the code below.
This is introduced in https://github.com/D-Programming-Language/dmd/pull/4091

Code:
struct S(N)
{
    void fun()
    {
        undefined_identifier;
        // or anything that makes the instantiation fail
    }

}

void test(T)(S!T)
{
}

void main()
{
    S!string g;
    test(g);
}

Output:
% dmd | head -n1
DMD64 D Compiler v2.067-devel-60bdb8c

% dmd -c test.d
test.d(5): Error: undefined identifier undefined_identifier
test.d(16): Error: template instance test.S!string error instantiating
dmd: template.c:2621: FuncDeclaration*
TemplateDeclaration::doHeaderInstantiation(TemplateInstance*, Scope*,
FuncDeclaration*, Type*, Expressions*): Assertion `fd->type->ty != Tfunction'
failed.

--
Jan 01 2015