Hi,

I think we can handle this 4.9 Regression ICE in build_value_init_noctor the same way as cx_check_missing_mem_inits: only enforce !TYPE_HAS_COMPLEX_DFLT when errorcount == 0 (I also double checked that in the case at issue type_has_constexpr_default_constructor is true).

Tested x86_64-linux.

Thanks,
Paolo.

////////////////////
/cp
2014-01-17  Paolo Carlini  <paolo.carl...@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.carl...@oracle.com>

        PR c++/59269
        * g++.dg/cpp0x/nsdmi-union4.C: New.
Index: cp/init.c
===================================================================
--- cp/init.c   (revision 206700)
+++ cp/init.c   (working copy)
@@ -382,7 +382,8 @@ build_value_init_noctor (tree type, tsubst_flags_t
      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: testsuite/g++.dg/cpp0x/nsdmi-union4.C
===================================================================
--- testsuite/g++.dg/cpp0x/nsdmi-union4.C       (revision 0)
+++ testsuite/g++.dg/cpp0x/nsdmi-union4.C       (working copy)
@@ -0,0 +1,12 @@
+// PR c++/59269
+// { dg-require-effective-target c++11 }
+
+union U
+{
+  int& i = 0;  // { dg-error "reference" }
+};
+
+void foo()
+{
+  U();
+}

Reply via email to