From: Paolo Carlini <paolo.carlini@oracle.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Jason Merrill <jason@redhat.com>
Subject: [C++ Patch] PR 42058
Date: Mon, 16 Nov 2009 17:41:00 -0000 [thread overview]
Message-ID: <4B018E0E.5020803@oracle.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 93 bytes --]
Hi,
another simple issue. Tested x86_64-linux. Ok for mainline?
Paolo.
//////////////////
[-- Attachment #2: CL_42058 --]
[-- Type: text/plain, Size: 460 bytes --]
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.
[-- Attachment #3: patch_42058 --]
[-- Type: text/plain, Size: 2107 bytes --]
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);
next reply other threads:[~2009-11-16 17:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-16 17:41 Paolo Carlini [this message]
2009-11-17 20:31 ` Paolo Carlini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B018E0E.5020803@oracle.com \
--to=paolo.carlini@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).