Bug 19477 – Circular alias this makes constructor not work with UFCS only

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-12-11T13:32:36Z
Last change time
2024-12-13T19:01:38Z
Assigned to
No Owner
Creator
Dennis
Moved to GitHub: dmd#19517 →

Comments

Comment #0 by dkorpel — 2018-12-11T13:32:36Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:01:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19517 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB