www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23371] New: Error Message For Using Non-static members

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

          Issue ID: 23371
           Summary: Error Message For Using Non-static members Statically
                    Could Be Better
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

struct Foo
{
    int a;
}

void main()
{
    Foo.a;
}

Gives the error

    onlineapp.d(8): Error: need `this` for `a` of type `int`

If possible, I'd like something like this

    onlineapp.d(8): Error: `a` of type `Foo` is not a static member and needs a
`this` pointer

--
Sep 24 2022