[Issue 23753] New: this allowed in static member function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 28 23:02:02 UTC 2023


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 at puremagic.com
          Reporter: johanengelen at 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.

--


More information about the Digitalmars-d-bugs mailing list