This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 42058


Hi,

another simple issue. Tested x86_64-linux. Ok for mainline?

Paolo.

//////////////////
cp/
2009-11-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42058
	* typeck2.c (digest_init_r): Check init for error_operand_p.
	* decl.c (reshape_init_class): Check return value of reshape_init_r
	for error_mark_node.

testsuite/
2009-11-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42058
	* testsuite/g++.dg/init/array26.C: New.
	* testsuite/g++.dg/init/array27.C: Likewise.
	* testsuite/g++.old-deja/g++.benjamin/13478.C: Adjust dg-errors.
Index: testsuite/g++.old-deja/g++.benjamin/13478.C
===================================================================
--- testsuite/g++.old-deja/g++.benjamin/13478.C	(revision 154202)
+++ testsuite/g++.old-deja/g++.benjamin/13478.C	(working copy)
@@ -27,10 +27,4 @@ const hand_table Agent::table_1[] =
    {0,     &Agent::table_2},
    {first, &Agent::foo},
    {last,  &(hand)Agent::foo} // { dg-error "" } no match
-}; // { dg-error "" } cannot convert
-
-
-
-
-
-
+};
Index: testsuite/g++.dg/init/array26.C
===================================================================
--- testsuite/g++.dg/init/array26.C	(revision 0)
+++ testsuite/g++.dg/init/array26.C	(revision 0)
@@ -0,0 +1,11 @@
+// PR c++/42058
+// { dg-options "" }
+
+struct A;
+
+struct B
+{
+  A a; // { dg-error "incomplete type" }
+};
+
+B b[1] = (B[]) { 0 }; // { dg-error "initializer" }
Index: testsuite/g++.dg/init/array27.C
===================================================================
--- testsuite/g++.dg/init/array27.C	(revision 0)
+++ testsuite/g++.dg/init/array27.C	(revision 0)
@@ -0,0 +1,11 @@
+// PR c++/42058
+// { dg-options "" }
+
+struct A {};
+
+struct B
+{
+  A a;
+};
+
+B b[1] = (B[]) { 0 }; // { dg-error "initializer" }
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 154202)
+++ cp/decl.c	(working copy)
@@ -4864,6 +4864,9 @@ reshape_init_class (tree type, reshape_iter *d, bo
 
       field_init = reshape_init_r (TREE_TYPE (field), d,
 				   /*first_initializer_p=*/false);
+      if (field_init == error_mark_node)
+	return error_mark_node;
+
       CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init), field, field_init);
 
       /* [dcl.init.aggr]
Index: cp/typeck2.c
===================================================================
--- cp/typeck2.c	(revision 154202)
+++ cp/typeck2.c	(working copy)
@@ -723,7 +723,7 @@ digest_init_r (tree type, tree init, bool nested,
 {
   enum tree_code code = TREE_CODE (type);
 
-  if (init == error_mark_node)
+  if (error_operand_p (init))
     return error_mark_node;
 
   gcc_assert (init);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]