Hi,

this is a 4.9 Regression, but just an ICE on invalid. It's a little tricky to fix, because, eg, in mainline (vs 4_8-branch) we want to produce somewhat more concise diagnostic in this area (eg, a single error for init/array26.C). It seems Ok to me, and passes testing, to return NULL_TREE from build_value_init. Alternately, more conservatively, we could change build_value_init_noctor to not call build_value_init at all when ftype == error_mark_node.

Tested x86_64-linux.

Thanks,
Paolo.

//////////////////////
/cp
2014-01-15  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/59270
        * init.c (build_value_init): Check type for error_mark_node.

/testsuite
2014-01-15  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/59270
        * g++.dg/cpp0x/decltype-incomplete1.C: New.
Index: cp/init.c
===================================================================
--- cp/init.c   (revision 206627)
+++ cp/init.c   (working copy)
@@ -311,6 +311,9 @@ build_zero_init (tree type, tree nelts, bool stati
 tree
 build_value_init (tree type, tsubst_flags_t complain)
 {
+  if (type == error_mark_node)
+    return NULL_TREE;
+
   /* [dcl.init]
 
      To value-initialize an object of type T means:
Index: testsuite/g++.dg/cpp0x/decltype-incomplete1.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype-incomplete1.C       (revision 0)
+++ testsuite/g++.dg/cpp0x/decltype-incomplete1.C       (working copy)
@@ -0,0 +1,9 @@
+// PR c++/59270
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  struct B b; // { dg-error "incomplete type" }
+};
+
+decltype(A()) a;

Reply via email to