]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/55249 (Multiple copy constructors for template class lead to link errors)
authorJason Merrill <jason@redhat.com>
Fri, 7 Dec 2012 04:58:32 +0000 (23:58 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 7 Dec 2012 04:58:32 +0000 (23:58 -0500)
PR c++/55249
* tree.c (build_vec_init_elt): Use the type of the initializer.

From-SVN: r194285

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/template/array25.C [new file with mode: 0644]

index a6b69cbe81a4e068302e9ca485b125f56d8904a1..2a607b896c26cc9cb38a490b17d079471d8ae2a6 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/55249
+       * tree.c (build_vec_init_elt): Use the type of the initializer.
+
 2012-11-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/53862
index 6a39cc9e448d33da514fc4a2987366d5564280f7..4d5407073f5ab115651affb3e865110c28eb3a4a 100644 (file)
@@ -490,7 +490,8 @@ build_vec_init_elt (tree type, tree init)
   argvec = make_tree_vector ();
   if (init)
     {
-      tree dummy = build_dummy_object (inner_type);
+      tree init_type = strip_array_types (TREE_TYPE (init));
+      tree dummy = build_dummy_object (init_type);
       if (!real_lvalue_p (init))
        dummy = move (dummy);
       VEC_quick_push (tree, argvec, dummy);
diff --git a/gcc/testsuite/g++.dg/template/array25.C b/gcc/testsuite/g++.dg/template/array25.C
new file mode 100644 (file)
index 0000000..4f3ccbf
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/55249
+
+template <typename _Tp> struct A
+{
+  _Tp _M_instance[1];
+};
+template <class> struct inner_type
+{
+    inner_type () {}
+    inner_type (inner_type &);
+    inner_type (const inner_type &) {}
+};
+
+int
+main ()
+{
+    A <inner_type <int> > a, b = a;
+}