* g++.dg/other/copy2.C: New test.

From-SVN: r53692
This commit is contained in:
Brian R. Gaeke 2002-05-21 17:26:50 +00:00 committed by Alexandre Oliva
parent c8a3d8890e
commit 32d3f6346a
2 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Tue May 21 14:25:32 2002 Brian R. Gaeke <brg@dgate.ORG>
* g++.dg/other/copy2.C: New test.
Mon May 20 10:51:35 2002 J"orn Rennecke <joern.rennecke@superh.com>
* gcc.c-torture/execute/memcpy-2.c (SEQUENCE_LENGTH): Define.

View File

@ -0,0 +1,32 @@
// { dg-do run }
// Test that A's copy assignment method is called when B's instance
// member array of A is assigned.
// Contributed by Brian Gaeke, public domain.
int status = 1;
class A
{
public:
int i;
A &operator =(const A &i)
{
status = 0;
}
};
class B
{
public:
A arr[10];
};
int main (int argc, char **argv)
{
B b;
b.arr[0].i = 15;
B a;
a = b; // trigger copy assignment
return status;
}