[Issue 15152] New: template fails to instantiate if argument is itself a template
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Oct 4 08:20:43 PDT 2015
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 at puremagic.com
Reporter: schuetzm at 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);
}
}
# dmd -c xx.d
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
--
More information about the Digitalmars-d-bugs
mailing list