aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/array3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/init/array3.C')
-rw-r--r--gcc/testsuite/g++.dg/init/array3.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/array3.C b/gcc/testsuite/g++.dg/init/array3.C
new file mode 100644
index 00000000000..700b263891f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array3.C
@@ -0,0 +1,23 @@
+// PR c++/6331
+// Bug: we were generating a badly cv-qualified ARRAY_TYPE in the
+// synthesized copy constructor for A, which then became the canonical
+// version, confusing later uses.
+
+struct A {
+ virtual ~A();
+ const float* f();
+ float fa[3];
+};
+
+struct B {
+ B(const A& ai) : a (ai) {}
+ A a;
+};
+
+void g (const float pos[3]);
+
+extern A& a;
+void h()
+{
+ g (a.f());
+}