aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian R. Gaeke <brg@dgate.ORG>2002-05-21 17:26:50 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2002-05-21 17:26:50 +0000
commit32d3f6346aa1a54bf186cf7498ecb46ce1b4a8d1 (patch)
treeb455e959e1ae7e408caae7fba702a2601e6d75e3
parentc8a3d8890e4548cf07c8aa01fbc5716e23364b51 (diff)
downloadgcc-32d3f6346aa1a54bf186cf7498ecb46ce1b4a8d1.zip
gcc-32d3f6346aa1a54bf186cf7498ecb46ce1b4a8d1.tar.gz
gcc-32d3f6346aa1a54bf186cf7498ecb46ce1b4a8d1.tar.bz2
* g++.dg/other/copy2.C: New test.
From-SVN: r53692
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/copy2.C32
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4f5290b..da87b8c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/g++.dg/other/copy2.C b/gcc/testsuite/g++.dg/other/copy2.C
new file mode 100644
index 0000000..335cab8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/copy2.C
@@ -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;
+}