[Bug c++/20142] [3.3/3.4/4.0 regression] implicit assignment operator with multi-dimensional array is broken

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Feb 24 15:49:00 GMT 2005


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-24 12:21 -------
Here's an even shorter testcase. It should return 0, but doesn't since
GCC 3.3. If I remove A's constructor, we get the failure since GCC 3.0.

======================================================
int n=4;

struct A
{
    A() {}
    A& operator= (const A&) { --n; return *this; }
};

struct B
{
    A x[2][2];
};

int main()
{
    B b;
    b = b;
    return n;
}
======================================================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.3 3.3.5 3.4.3 4.0.0       |3.0 3.2.3 3.3 3.3.5 3.4.3
                   |                            |4.0.0
      Known to work|2.95.3 3.0.4 3.2.3          |2.95.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20142



More information about the Gcc-bugs mailing list