www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23753] New: this allowed in static member function

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

          Issue ID: 23753
           Summary: this allowed in static member function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

Testcase:
```
void g(int);

struct S {
    size_t member;

    static void foo(byte member) {
        g(this.member.sizeof);  // <---
    }
}
```

The code accepted by the compiler, but shouldn't be: `this` has no meaning in a
_static_ member function.

--
Feb 28 2023