Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular alias this makes constructor not work with UFCS only #19517

Open
dlangBugzillaToGithub opened this issue Dec 11, 2018 · 0 comments
Open
Labels

Comments

@dlangBugzillaToGithub
Copy link

Dennis (@dkorpel) reported this on 2018-12-11T13:32:36Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19477

Description

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.
@thewilsonator thewilsonator added the Feature:alias alias and alias this label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants