Bug 23417 – Confusing error message when assigning non-existent struct field to the same name global variable

Status
NEW
Severity
regression
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-10-15T20:57:58Z
Last change time
2024-12-13T19:25:04Z
Keywords
diagnostic
Assigned to
No Owner
Creator
skocznymr
Moved to GitHub: dmd#20166 →

Comments

Comment #0 by skocznymr — 2022-10-15T20:57:58Z
struct Foo { int b; } int bar; void main() { Foo f; bar = f.bar; } Example code to reproduce the issue. Error message is: "Failure with output: onlineapp.d(11): Error: function expected before `()`, not `bar` of type `int`" Potential regression in 2.063 Up to 2.062 : Failure with output: onlineapp.d(11): Error: no property 'bar' for type 'Foo', did you mean 'b'? 2.063 to 2.078.3: Failure with output: onlineapp.d(11): Error: function expected before (), not bar of type int Since 2.079.1: Failure with output: onlineapp.d(11): Error: function expected before `()`, not `bar` of type `int`
Comment #1 by b2.temp — 2022-10-15T22:15:24Z
The diagnostic that's output is actually the failed UFCS attempt on `bar`. You get the same error message with `bar(f)` for example.
Comment #2 by robert.schadek — 2024-12-13T19:25:04Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20166 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB