[Issue 7075] New: Struct class comparison should check opAssign for	class
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Dec  6 20:32:41 PST 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7075
           Summary: Struct class comparison should check opAssign for
                    class
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody at puremagic.com
        ReportedBy: Jesse.K.Phillips+D at gmail.com
--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2011-12-06 20:32:40 PST ---
The table states that classes do not overload the assignment operator. However
this code compiles:
class A {
    int a;
    string b;
    float c;
    void opAssign(B b) {
       a = b.a;
    }
}
class B {
    int a;
}
void main()
{
    auto a = new A();
    a.a = 5;
    auto b = new B();
    b.a = 10;
    a = b;
    assert(a.a == 10);
}
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list