May 02, 2021 [Issue 21886] New: case where member function used as "alias this sym" is allowed without right `this` context | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21886 Issue ID: 21886 Summary: case where member function used as "alias this sym" is allowed without right `this` context Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: accepts-invalid Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: b2.temp@gmx.com This code compiles and runs. --- struct D { static int a; } struct C { int h; D get() { assert(h); assert(false); } alias get this; } void main(string[] args) { if (C.a){} } --- get() is not executed but in first place that should not compile as in C.a there's not valid this context. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply