June 09, 2023 [Issue 23981] enum siblings and struct member naming conflict undetected and counter intuitive path prefered | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23981 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl Hardware|x86_64 |All OS|Linux |All --- Comment #1 from Dennis <dkorpel@live.nl> --- I reduced the example a bit: ```D struct B { int j; bool down() {return true;} } enum button { shift = B(0), down = B(1), // without this line, it compiles } void main() { // Error: struct `B` does not overload () if (button.shift.down()) {} } ``` This is indeed very confusing, and a result of D allowing you to access static properties of a type using an instance of that type. I don't know if the specification says one of them is supposed to have priority. -- |
Copyright © 1999-2021 by the D Language Foundation