diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2009-11-17 20:03:03 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-11-17 20:03:03 +0000 |
commit | 97471c71bfe5d692043166106599eca3374b0370 (patch) | |
tree | 8de8dcf4633037e738ce07ab5674df1a38e63f98 /gcc/cp | |
parent | 6bab0284947ba4c0e4028ea7703d90a8fba932b2 (diff) | |
download | gcc-97471c71bfe5d692043166106599eca3374b0370.zip gcc-97471c71bfe5d692043166106599eca3374b0370.tar.gz gcc-97471c71bfe5d692043166106599eca3374b0370.tar.bz2 |
re PR c++/42058 (Trouble with invalid array initialization)
cp/
2009-11-17 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-17 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.
From-SVN: r154267
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4f5f9b5..17968f5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-11-17 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. + 2009-11-17 Jakub Jelinek <jakub@redhat.com> PR c++/42061 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 851edeb..f57efb7 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4878,6 +4878,9 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p) 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] diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 96fa442..6cb1152 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -723,7 +723,7 @@ digest_init_r (tree type, tree init, bool nested, int flags) { enum tree_code code = TREE_CODE (type); - if (init == error_mark_node) + if (error_operand_p (init)) return error_mark_node; gcc_assert (init); |