www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19117] New: Alias this messes up call to normal function


          Issue ID: 19117
           Summary: Alias this messes up call to normal function
           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
    immutable(A) fun() { return  immutable A(); }
    ref A fun2(ref A a)  { return this; }                                       

    alias fun this;    // line 6

void main()
    A a, b;

aliasthisbug.d(12): Error: function aliasthisbug.A.fun2(ref A a) is not
callable using argument types (A)
aliasthisbug.d(12):        cannot pass argument a of type A to parameter ref A

Comment line 6 an the error disappears.

Jul 26 2018