www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15152] New: template fails to instantiate if argument is

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

          Issue ID: 15152
           Summary: template fails to instantiate if argument is itself a
                    template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schuetzm gmx.net

// xx.d
struct ErrorDisplayAttribute(alias DISPLAY_METHOD) {
    enum displayMethodName = __traits(identifier, DISPLAY_METHOD);
}

void foo1() { }

private void handleRequest(string M)() { }

void main() {
    enum erruda_value = ErrorDisplayAttribute!(foo1).init;
    static if(true) {    // change to `false` to make it compile
        handleRequest!(erruda_value.displayMethodName);    // line 12
    } else {
        enum temp = erruda_value.displayMethodName;
        handleRequest!(temp);
    }
}


xx.d(12): Error: template instance handleRequest!(displayMethodName) does not
match template declaration handleRequest(string M)()

According to digger, this was introduced in:
https://github.com/D-Programming-Language/dmd/pull/5123

--
Oct 04 2015