re PR c++/48606 (g++.dg/init/ctor9.C ICE: tree check: expected class 'type', have...
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 29 Apr 2011 22:03:40 +0000 (22:03 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 29 Apr 2011 22:03:40 +0000 (22:03 +0000)
/cp
2011-04-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/48606
* init.c (perform_member_init): Check build_value_init return
value for error_mark_node.

/testsuite
2011-04-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/48606
* g++.dg/init/ctor10.C: New.

From-SVN: r173194

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

index 7cd5eb66bcfbb3a3f07615e875198bbe3a4e45c0..55ba50bf93f6dcd1fe1b107dd51431d5ab47a009 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/48606
+       * init.c (perform_member_init): Check build_value_init return
+       value for error_mark_node.
+
 2011-04-29  Nicola Pero  <nicola.pero@meta-innovation.com>,
            Mike Stump <mikestump@comcast.net>
 
index 3f888576bf65020222eed1e17ad8c952cc5ef2ca..d8b19c7491ee2580a923cbd6260ecb2b5ccf36d9 100644 (file)
@@ -513,8 +513,10 @@ perform_member_init (tree member, tree init)
        }
       else
        {
-         init = build2 (INIT_EXPR, type, decl,
-                        build_value_init (type, tf_warning_or_error));
+         tree value = build_value_init (type, tf_warning_or_error);
+         if (value == error_mark_node)
+           return;
+         init = build2 (INIT_EXPR, type, decl, value);
          finish_expr_stmt (init);
        }
     }
index 42ea961e1762f54ea4326c06e96033e65c9484c7..873e368c163190fda2546e240cfb7ecb100ea5ce 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/48606
+       * g++.dg/init/ctor10.C: New.
+
 2011-04-29  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/48462
diff --git a/gcc/testsuite/g++.dg/init/ctor10.C b/gcc/testsuite/g++.dg/init/ctor10.C
new file mode 100644 (file)
index 0000000..91cc250
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/48606
+// { dg-do compile }
+// { dg-options "-fkeep-inline-functions" }
+
+struct S
+{
+  int &ref;
+  S() : ref() {};      // { dg-error "value-initialization of" }
+};