www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19251] New: Alias this does not get called on struct


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

struct A
    int[] a;
    immutable(A) fun()
        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.

Sep 18 2018