[Issue 19251] New: Alias this does not get called on struct qualified type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 18 11:06:45 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19251

          Issue ID: 19251
           Summary: Alias this does not get called on struct qualified
                    type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: razvan.nitu1305 at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list