digitalmars.D.bugs - [Issue 12339] New: "alais this" not considered for qualified conversion
- d-bugmail puremagic.com (35/35) Mar 10 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12339
- d-bugmail puremagic.com (29/29) Mar 10 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12339
- d-bugmail puremagic.com (13/16) Mar 10 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12339
https://d.puremagic.com/issues/show_bug.cgi?id=12339 Summary: "alais this" not considered for qualified conversion Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: monarchdodra gmail.com I'd expect an implicit "const S" => "S" conversion to work if an "alias this" call allows it. //------------ //alias T = int; //OK alias T = S; //FAIL static struct S { int* p; T asMutable() const; alias asMutable this; } void main() { immutable S s; T ss = s; } //------------ I see this as a needless limitation: The fact that the types match should not prevent the alias this call from happening. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 10 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12339 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim maxim-fomin.ru --- I think it does not work because struct contains pointer. If you comment out it, it will work. Note that dispite you alias to S type, S itself contains indirections. //alias T = int; //OK //alias T = S; //FAIL alias T = SS; // OK static struct S { int* p; T asMutable() const { return T(); } alias asMutable this; } struct SS { } void main() { immutable S s; T ss = s; } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 10 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12339I think it does not work because struct contains pointer. If you comment out it, it will work. Note that dispite you alias to S type, S itself contains indirections.I know, that was the point. I *wanted* a type were "const(S)" can't be implicitly cast to "S" The "issue" is that "const(S)" has an alias this to a function that produces an "S", meaning (AFAIK) that according to alias this rules, that this conversion should be considered. I mean: Why would "alias this" be OK to get an "int", but doesn't work to get an "S"? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 10 2014