www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23417] New: Confusing error message when assigning

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

          Issue ID: 23417
           Summary: Confusing error message when assigning non-existent
                    struct field to the same name global variable
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: skocznymr gmail.com

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`

--
Oct 15 2022