]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58965 ([c++11] ICE with member initializer in static union)
authorJason Merrill <jason@redhat.com>
Tue, 7 Jan 2014 21:24:37 +0000 (16:24 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 7 Jan 2014 21:24:37 +0000 (16:24 -0500)
PR c++/58965
* mangle.c (write_guarded_var_name): Handle null DECL_NAME.

From-SVN: r206405

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/testsuite/g++.dg/cpp0x/nsdmi-union3.C [new file with mode: 0644]

index b31014fcc752ab2e55f8105fb69cc3584bd36f40..cdb376d9c6d40d2e14d4f90901858f1585c564a3 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/58965
+       * mangle.c (write_guarded_var_name): Handle null DECL_NAME.
+
 2014-01-07  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * semantics.c (trait_expr_value, [CPTK_IS_BASE_OF]): Implement
index 6f32a43f3236f348624bcb989149a521f7129521..dc7d4eab9013da1315e4aa00152f881b30c75e65 100644 (file)
@@ -3775,7 +3775,8 @@ mangle_conv_op_name_for_type (const tree type)
 static void
 write_guarded_var_name (const tree variable)
 {
-  if (strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
+  if (DECL_NAME (variable)
+      && strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
     /* The name of a guard variable for a reference temporary should refer
        to the reference, not the temporary.  */
     write_string (IDENTIFIER_POINTER (DECL_NAME (variable)) + 4);
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-union3.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-union3.C
new file mode 100644 (file)
index 0000000..35f6509
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/58965
+// { dg-require-effective-target c++11 }
+
+void foo()
+{
+  static union
+  {
+    int i = i;
+  };
+}