Thread overview
[Issue 21288] Wrong context pointer for alias this function
October 01

Mathias LANG <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from Mathias LANG <> ---
Wait, is this code even valid ?

Here in `` & `foo` you are calling `B.p`, as a shortcut for `B.a.p`, but
`a()` is not static, hence you should not be able to do that.
Indeed if you change the expression to `B.a.p` it gives you a proper error
message. So the second case is an accept-invalid, and the first case could use
with a better error message.

October 01

--- Comment #2 from Richard Manthorpe <> ---
It feels like it should be valid. If there is an `alias this` you should really have to know whether something is in `B` or `A`. Since you can do things like `A.p.stringof` or `__traits(getAttributes, A.p)` which requires a symbol, you should probably also be able to do `B.p.stringof` or `__traits(getAttributes, B.p)`.

October 02

--- Comment #3 from Mathias LANG <> ---
Right, because it's `stringof`. Just tested and it also trigggers with

A workaround for this issue would be to use the following:
static assert(__traits(identifier, typeof(B.init.a()).p) == "p");
Which works as expected.