PR c++/51462 - ICE in cx_check_missing_mem_inits
authorDodji Seketeli <dodji@redhat.com>
Mon, 2 Jan 2012 17:00:13 +0000 (17:00 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Mon, 2 Jan 2012 17:00:13 +0000 (18:00 +0100)
gcc/cp/

PR c++/51462
* semantics.c (cx_check_missing_mem_inits): Don't assert in case
of error.

gcc/testsuite/

PR c++/51462
* g++.dg/cpp0x/constexpr-99.C: New test.

From-SVN: r182806

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-99.C [new file with mode: 0644]

index 7b91727aca90212e96fb78f51f846123298fb26a..23f3ae020a3f1e255d3ff0e0097b55ba2acbf4b0 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-02  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/51462
+       * semantics.c (cx_check_missing_mem_inits): Don't assert in case
+       of error.
+
 2012-01-02  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/20140
index 835632fcfbaf1a42330bb4160508b7195ef8e5cd..55b0a0215eaa264b81395ed737f4eb89f9f5692f 100644 (file)
@@ -6051,7 +6051,8 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain)
              /* It's OK to skip a member with a trivial constexpr ctor.
                 A constexpr ctor that isn't trivial should have been
                 added in by now.  */
-             gcc_checking_assert (!TYPE_HAS_COMPLEX_DFLT (ftype));
+             gcc_checking_assert (!TYPE_HAS_COMPLEX_DFLT (ftype)
+                                  || errorcount != 0);
              continue;
            }
          error ("uninitialized member %qD in %<constexpr%> constructor",
index ea547a3f70a69f62e078d3de366c364266af7647..ad865dbbbe5321780c722fd20c5477861808eeb4 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-02  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/51462
+       * g++.dg/cpp0x/constexpr-99.C: New test.
+
 2012-01-02  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/20140
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-99.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-99.C
new file mode 100644 (file)
index 0000000..13a5ea3
--- /dev/null
@@ -0,0 +1,13 @@
+// Origin PR c++/51462
+// { dg-options "-std=c++11" }
+
+struct A
+{
+  int i = 0;
+};
+
+struct B
+{
+  A a;
+    constexpr B() : a(0) {} // { dg-error "no matching function" }
+};