www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7075] New: Struct class comparison should check opAssign for class

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com



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: -------
Dec 06 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7075


Jesse Phillips <Jesse.K.Phillips+D gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Jesse.K.Phillips+D gmail.co
                   |                            |m



20:36:26 PST ---
Forgot the pages:

http://www.d-programming-language.org/struct

and this one only mentions struct:

http://www.d-programming-language.org/operatoroverloading.html#Assignment

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7075


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |mrmocool gmx.de
            Summary|Struct class comparison     |overloading opAssign for
                   |should check opAssign for   |class is allowed
                   |class                       |
           Severity|normal                      |critical


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 07 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7075


Steven Schveighoffer <schveiguy yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |
                 CC|                            |schveiguy yahoo.com
            Summary|overloading opAssign for    |overloading opAssign for
                   |class is allowed            |classes is poorly specified



07:46:59 PST ---
No, the code isn't invalid, the documentation is just bad.

identity assignment overloading is not allowed for classes, that is what the
table is alluding to:

class A
{
   void opAssign(A a) {}
}

Error: function testassign.A.opAssign identity assignment operator overload is
illegal

There are several other places in the spec that could be better written.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 07 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7075


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
                 CC|                            |bugzilla digitalmars.com
           Severity|critical                    |normal



02:13:22 PDT ---
Doc bugs aren't critical.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 28 2012