parent
c8a3d8890e
commit
32d3f6346a
|
@ -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>
|
Mon May 20 10:51:35 2002 J"orn Rennecke <joern.rennecke@superh.com>
|
||||||
|
|
||||||
* gcc.c-torture/execute/memcpy-2.c (SEQUENCE_LENGTH): Define.
|
* gcc.c-torture/execute/memcpy-2.c (SEQUENCE_LENGTH): Define.
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue