From: Jason Merrill Date: Fri, 7 Dec 2012 04:58:32 +0000 (-0500) Subject: re PR c++/55249 (Multiple copy constructors for template class lead to link errors) X-Git-Tag: releases/gcc-4.6.4~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b86ad3612d6644cfb942e85ea18d5d88989e706e;p=thirdparty%2Fgcc.git re PR c++/55249 (Multiple copy constructors for template class lead to link errors) PR c++/55249 * tree.c (build_vec_init_elt): Use the type of the initializer. From-SVN: r194285 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a6b69cbe81a4..2a607b896c26 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-12-06 Jason Merrill + + PR c++/55249 + * tree.c (build_vec_init_elt): Use the type of the initializer. + 2012-11-29 Jason Merrill PR c++/53862 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6a39cc9e448d..4d5407073f5a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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 index 000000000000..4f3ccbf702da --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array25.C @@ -0,0 +1,18 @@ +// PR c++/55249 + +template struct A +{ + _Tp _M_instance[1]; +}; +template struct inner_type +{ + inner_type () {} + inner_type (inner_type &); + inner_type (const inner_type &) {} +}; + +int +main () +{ + A > a, b = a; +}