[Issue 21466] New: Calling an enum value result in confusing error message "No property X for type Y"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 10 12:51:15 UTC 2020


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

          Issue ID: 21466
           Summary: Calling an enum value result in confusing error
                    message "No property X for type Y"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com

Reduced case:
```
enum Foo
{
    a,
    b,
}

void main ()
{
    auto z = Foo.a(STC.b);
}
```
Gives:
```
parseme.d(9): Error: no property a for type int
```

This is quite confusing, as the error message doesn't actually tell what's
wrong (a is not callable).
This is reduced from a bigger error, where the actual code used a ternary and
was missing a bitwise OR (`|`), causing the line to be interpreted as a call.

--


More information about the Digitalmars-d-bugs mailing list