]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/54511 (internal compiler error: in make_decl_rtl, at varasm.c:1147)
authorJason Merrill <jason@redhat.com>
Thu, 13 Sep 2012 15:13:45 +0000 (11:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 13 Sep 2012 15:13:45 +0000 (11:13 -0400)
PR c++/54511
* pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P.

From-SVN: r191262

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

index b7d8a1d43d5e5e16e80e411c87128d539af0249e..6d135a35b44b050034192916907b933198782242 100644 (file)
@@ -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.
index 4cf2ed8917bd50102a050821375bd8ebb50f7c99..5b7976ae964efe95e1ec74391f85325144cd5daa 100644 (file)
@@ -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)
index debdd885c3039c89ce8093ab747b782b1f2b0f5f..3b813a3f0148548a137ec35f1bbd1571615c1f7d 100644 (file)
@@ -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 (file)
index 0000000..cb3c12d
--- /dev/null
@@ -0,0 +1,6 @@
+template <int i>
+struct S
+{
+  S () { union { int a; }; a = 0; }
+};
+S<0> s;