aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-12-06 23:53:46 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-12-06 23:53:46 -0500
commit01290963d131b098cc4b0f3f5d3401e976eb8d6e (patch)
treeff9846a31edd88ec6b391200581f81d67e77189d /gcc
parent2c340383f06c567a638e5f557c4e16d02b92c436 (diff)
downloadgcc-01290963d131b098cc4b0f3f5d3401e976eb8d6e.zip
gcc-01290963d131b098cc4b0f3f5d3401e976eb8d6e.tar.gz
gcc-01290963d131b098cc4b0f3f5d3401e976eb8d6e.tar.bz2
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: r194281
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/tree.c3
-rw-r--r--gcc/testsuite/g++.dg/template/array25.C18
3 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bcad0c2..22bdb50 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +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.
+
PR c++/54744
* pt.c (resolve_typename_type): Check TYPENAME_IS_RESOLVING_P on scope.
* init.c (expand_member_init): Check for being in a template first.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 58725f3..28ff0f2 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -524,7 +524,8 @@ build_vec_init_elt (tree type, tree init, tsubst_flags_t complain)
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);
argvec->quick_push (dummy);
diff --git a/gcc/testsuite/g++.dg/template/array25.C b/gcc/testsuite/g++.dg/template/array25.C
new file mode 100644
index 0000000..4f3ccbf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array25.C
@@ -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;
+}