aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-09-13 11:13:45 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-09-13 11:13:45 -0400
commitafcf5b8e90cde4d5e61785464c3928fb9c965499 (patch)
treeeb06e4aee18295d0c9ceae83eddfc493ac3f9e47 /gcc
parent7c8233ce846dd7f68992b0bbfafae87fb46b83ab (diff)
downloadgcc-afcf5b8e90cde4d5e61785464c3928fb9c965499.zip
gcc-afcf5b8e90cde4d5e61785464c3928fb9c965499.tar.gz
gcc-afcf5b8e90cde4d5e61785464c3928fb9c965499.tar.bz2
re PR c++/54511 (internal compiler error: in make_decl_rtl, at varasm.c:1147)
PR c++/54511 * pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P. From-SVN: r191262
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c10
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/template/anonunion2.C6
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b7d8a1d..6d135a3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2012-09-13 Jason Merrill <jason@redhat.com>
+ PR c++/54511
+ * pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P.
+
PR c++/53836
* pt.c (value_dependent_expression_p): A TREE_LIST initializer must
be dependent.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 4cf2ed8..5b7976a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10443,6 +10443,16 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
break;
}
+ if (TREE_CODE (t) == VAR_DECL && DECL_ANON_UNION_VAR_P (t))
+ {
+ /* Just use name lookup to find a member alias for an anonymous
+ union, but then add it to the hash table. */
+ r = lookup_name (DECL_NAME (t));
+ gcc_assert (DECL_ANON_UNION_VAR_P (r));
+ register_local_specialization (r, t);
+ break;
+ }
+
/* Create a new node for the specialization we need. */
r = copy_decl (t);
if (type == NULL_TREE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index debdd88..3b813a3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-09-13 Jason Merrill <jason@redhat.com>
+ PR c++/54511
+ * g++.dg/template/anonunion2.C: New.
+
PR c++/53836
* g++.dg/template/init10.C: New.
diff --git a/gcc/testsuite/g++.dg/template/anonunion2.C b/gcc/testsuite/g++.dg/template/anonunion2.C
new file mode 100644
index 0000000..cb3c12d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/anonunion2.C
@@ -0,0 +1,6 @@
+template <int i>
+struct S
+{
+ S () { union { int a; }; a = 0; }
+};
+S<0> s;