www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13768] New: Refused template method instantiation with enum

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

          Issue ID: 13768
           Summary: Refused template method instantiation with enum struct
                    field
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

struct Foo {
    immutable x = 0;
    void bar(int y)() {}
}
void main() {
    enum f = Foo();
    enum x2 = f.x;
    f.bar!(x2);  // OK
    f.bar!(f.x); // Error
}


dmd 2.067alpha:

test.d(9,6): Error: template instance bar!(x) does not match template
declaration bar(int y)()

--
Nov 23 2014