Bug 19251 – Alias this does not get called on struct qualified type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-09-18T11:06:45Z
Last change time
2018-10-01T14:08:31Z
Assigned to
No Owner
Creator
RazvanN

Comments

Comment #0 by razvan.nitu1305 — 2018-09-18T11:06:45Z
struct A { int[] a; immutable(A) fun() { writeln("Yo"); return immutable A([7]); } alias fun this; } void main() { A a; immutable A b = a; // error: cannot implicitly convert expression a of type A to immutable(A) } This code should print YO.
Comment #1 by razvan.nitu1305 — 2018-09-18T13:05:47Z
Comment #2 by github-bugzilla — 2018-10-01T14:08:30Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/37605ece47e30869b8dac103ad8f8cc789cd5b8f Fix Issue 19251 - Alias this does not get called on struct qualified type https://github.com/dlang/dmd/commit/94f39988bc40568a7d90dd581f2d05c76e26d11d Merge pull request #8711 from RazvanN7/Issue_19251 Fix Issue 19251 - Alias this does not get called on struct qualified type