www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20039] New: ICE from double template instantiation with

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

          Issue ID: 20039
           Summary: ICE from double template instantiation with getMember
                    of overload of class and template function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

void foo()() { }
class bar { }

alias bug = foo;
alias bug = bar;

template Identity(T...) { }

alias member1 = Identity!(__traits(getMember, mixin(__MODULE__), "bug"));
alias member2 = Identity!(__traits(getMember, mixin(__MODULE__), "bug"));

With this, DMD crashes, because it cannot determine the type of "bug" to see if
the template parameters are equal.

Note that with this variation, a different crash ensues:

void main() {
    alias member1 = Identity!(.bug);
    alias member2 = Identity!(.bug);
}

--
Jul 10 2019