`alias x = v.x;` not working in struct bodies?

Max Samukha maxsamukha at gmail.com
Sat Jan 20 15:34:59 UTC 2024


On Saturday, 20 January 2024 at 14:56:52 UTC, Max Samukha wrote:

>
> It's not an alias of some arbitrary symbol. The field is 
> accessible through 'this' of the deriving struct, and it is 
> reasonable to expect it should be accessible though an alias in 
> the context of that 'this'.

Disregard that. I assumed there was 'alias this' in the OP's 
example. Now the question is, should this work:

```
struct S
{
     int x;
}

struct S2
{
     S s;
     alias this = s;
     alias x = S.x;
}

auto x = S2().x; // Error: need 'this'
```
?


More information about the Digitalmars-d mailing list