]> 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:08 +0000 (11:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 13 Sep 2012 15:13:08 +0000 (11:13 -0400)
PR c++/54511
* pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P.

From-SVN: r191260

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

index c538751167983c7f255f5e3ea06dcc14fb84a8e7..e3208d9ebe1d8d59b69dfbe367613d378fa89d28 100644 (file)
@@ -1,3 +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.
+
 2012-06-25  Jason Merrill  <jason@redhat.com>
 
        PR c++/52988
index 4defa853eaa65c2c77707080a8059c222cab9a4d..42e8a5972be74fefe4b8d78ca63bfd5394c8e9ea 100644 (file)
@@ -10028,6 +10028,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 aa13012bb43c7862f16f6788565a6e9fe23814ab..759e32f6a85ff5b3941b7f6e0b3abc2e00b78604 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-13  Jason Merrill  <jason@redhat.com>
+
+       PR c++/54511
+       * g++.dg/template/anonunion2.C: New.
+
 2012-09-12  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/54208
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;