[Issue 16426] New: Templated opAssign do not forward on Alias this.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 24 06:14:11 PDT 2016


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

          Issue ID: 16426
           Summary: Templated opAssign do not forward on Alias this.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: patric.dexheimer at gmail.com

import std.stdio;

struct Base{
    void opAssign(T)(T x){
        writeln("assigning : ",x);
    }        
}
struct Derived{
    Base parent;
    alias parent this;
}

void main()
{
    Base a;
    a = 10; //ok

    Derived b;
    b = 20;    //Error
}

Output:

Error: function f937.Derived.opAssign (Derived p) is not callable using
argument types (int)

--


More information about the Digitalmars-d-bugs mailing list