Make `& Class.foo` illegal

Johan j at j.nl
Thu Aug 27 11:20:17 UTC 2020


Currently this code is not rejected by the compiler and instead 
creates non-functioning (undefined) code:
```
struct S {
     void foo() {}
}

void main() {
     auto a = &S.foo;
}
```

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

Considering https://www.digitalmars.com/articles/b68.html, why 
not simply reject `&S.foo` during semantic analysis?

-Johan



More information about the Digitalmars-d mailing list