Issue 19477 - Circular alias this makes constructor not work with UFCS only
Summary: Circular alias this makes constructor not work with UFCS only
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-11 13:32 UTC by Dennis
Modified: 2022-12-17 10:37 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dennis 2018-12-11 13:32:36 UTC
I created two types that can convert to eachother:
```
struct Q16 {
    Q32 toQ32() {return Q32.init;}
    alias toQ32 this;
}

struct Q32 {
    this(Q16 a) {}
    Q16 toQ16() {return Q16.init;}
    alias toQ16 this;
}

void main() {
    auto x = Q32(Q16.init);
    auto y = Q16.init.Q32;
}
```

The assignment of x compiles, but for y you get "Error: cannot resolve identifier Q32". Removing either of the "alias this" makes it work.