Bug 21466 – Calling an enum value result in confusing error message "No property X for type Y"

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-12-10T12:51:15Z
Last change time
2024-12-13T19:13:24Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Mathias LANG
Moved to GitHub: dmd#18008 →

Comments

Comment #0 by pro.mathias.lang — 2020-12-10T12:51:15Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:13:24Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18008 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB