www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21354] New: 'cannot deduce function' errors print enum

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

          Issue ID: 21354
           Summary: 'cannot deduce function' errors print enum template
                    params in an ugly way
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: elpenguino+D gmail.com

```
enum Test {
    a,
    b
}

void test(Test t : Test.a)() {}

void main() {
    test!(Test.b)();
}
```
This code, on DMD 2.094.1 and earlier, prints the error `Error: template
instance test!(cast(Test)1) does not match template declaration test(Test t :
(Test).a)()`.  This is also true when there are multiple matching candidates.
dmd should print `Test.b` rather than `cast(Test)1`.

--
Nov 01 2020