]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59269 (ICE with reference in union)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 17 Jan 2014 15:40:13 +0000 (15:40 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 17 Jan 2014 15:40:13 +0000 (15:40 +0000)
/cp
2014-01-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/59269
* init.c (build_value_init_noctor): Assert !TYPE_HAS_COMPLEX_DFLT
only when errorcount == 0.

/testsuite
2014-01-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/59269
* g++.dg/cpp0x/nsdmi-union4.C: New.

From-SVN: r206718

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

index 66896d9aa135e61142cc9c70a231921638896614..45a6c9778e82fb3947205738b765bc0d9686a9fe 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/59269
+       * init.c (build_value_init_noctor): Assert !TYPE_HAS_COMPLEX_DFLT
+       only when errorcount == 0.
+
 2014-01-17  Marek Polacek  <polacek@redhat.com>
 
        PR c++/59838
index 67761dcf4d7c78ad0d9516e76a3cc4f7010a06bd..931b5c8c1d2551444922eaf0788d5b4179d372f3 100644 (file)
@@ -382,7 +382,8 @@ build_value_init_noctor (tree type, tsubst_flags_t complain)
      SFINAE-enabled.  */
   if (CLASS_TYPE_P (type))
     {
-      gcc_assert (!TYPE_HAS_COMPLEX_DFLT (type));
+      gcc_assert (!TYPE_HAS_COMPLEX_DFLT (type)
+                 || errorcount != 0);
        
       if (TREE_CODE (type) != UNION_TYPE)
        {
index 6d57b4126885449a2a2cf0602f96350925f2eb63..98bc5280293064ad40e752ced57bde9831dbfe3b 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/59269
+       * g++.dg/cpp0x/nsdmi-union4.C: New.
+
 2014-01-17  Marek Polacek  <polacek@redhat.com>
 
        PR c++/59838
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-union4.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-union4.C
new file mode 100644 (file)
index 0000000..c21fdca
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/59269
+// { dg-require-effective-target c++11 }
+
+union U
+{
+  int& i = 0;  // { dg-error "reference" }
+};
+
+void foo()
+{
+  U();
+}