diff options
author | Mark Mitchell <mark@codesourcery.com> | 2006-10-17 22:25:35 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2006-10-17 22:25:35 +0000 |
commit | 05b22df961070e926ac6bf4a8a114c5d5b1745bc (patch) | |
tree | 7ae5ef2f3ce54bf483d079ff2b41fe4ea8cb9cc1 /gcc | |
parent | b3b363332380c4306374247285e21a7ac771731b (diff) | |
download | gcc-05b22df961070e926ac6bf4a8a114c5d5b1745bc.zip gcc-05b22df961070e926ac6bf4a8a114c5d5b1745bc.tar.gz gcc-05b22df961070e926ac6bf4a8a114c5d5b1745bc.tar.bz2 |
re PR c++/27270 (ICE in process_init_constructor_array, at cp/typeck2.c:788)
PR c++/27270
* decl.c (reshape_init_class): Move check for designated
to ...
* parser.c (cp_parser_initializer_list): ... here.
* pt.c (tsubst_copy_and_build): Use finish_compound_literal.
PR c++/27270
* g++.dg/ext/complit8.C: Tweak error markers.
* g++.dg/template/complit1.C: Add error marker.
From-SVN: r117832
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/complit8.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/complit1.C | 2 |
7 files changed, 22 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e603fd5..4728586 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2006-10-17 Mark Mitchell <mark@codesourcery.com> + + PR c++/27270 + * decl.c (reshape_init_class): Move check for designated + to ... + * parser.c (cp_parser_initializer_list): ... here. + * pt.c (tsubst_copy_and_build): Use finish_compound_literal. + 2006-10-16 Mark Mitchell <mark@codesourcery.com> PR c++/27270 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e814c0a..11bb648 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4485,9 +4485,6 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p) /* Handle designated initializers, as an extension. */ if (d->cur->index) { - if (pedantic) - pedwarn ("ISO C++ does not allow designated initializers"); - field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); if (!field || TREE_CODE (field) != FIELD_DECL) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1ffc9ee..dfcbe73 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12736,6 +12736,9 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p) && cp_lexer_next_token_is (parser->lexer, CPP_NAME) && cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_COLON) { + /* Warn the user that they are using an extension. */ + if (pedantic) + pedwarn ("ISO C++ does not allow designated initializers"); /* Consume the identifier. */ identifier = cp_lexer_consume_token (parser->lexer)->value; /* Consume the `:'. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ce5a809..9a46264 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9323,7 +9323,6 @@ tsubst_copy_and_build (tree t, VEC(constructor_elt,gc) *n; constructor_elt *ce; unsigned HOST_WIDE_INT idx; - tree r; tree type = tsubst (TREE_TYPE (t), args, complain, in_decl); bool process_index_p; @@ -9347,15 +9346,10 @@ tsubst_copy_and_build (tree t, ce->value = RECUR (ce->value); } - r = build_constructor (NULL_TREE, n); - TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t); + if (TREE_HAS_CONSTRUCTOR (t)) + return finish_compound_literal (type, n); - if (type) - { - r = reshape_init (type, r); - return digest_init (type, r); - } - return r; + return build_constructor (NULL_TREE, n); } case TYPEID_EXPR: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 603cbed..4fed928 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-10-17 Mark Mitchell <mark@codesourcery.com> + + PR c++/27270 + * g++.dg/ext/complit8.C: Tweak error markers. + * g++.dg/template/complit1.C: Add error marker. + 2006-10-16 Mark Mitchell <mark@codesourcery.com> PR c++/27270 diff --git a/gcc/testsuite/g++.dg/ext/complit8.C b/gcc/testsuite/g++.dg/ext/complit8.C index b778b4b..97ff563 100644 --- a/gcc/testsuite/g++.dg/ext/complit8.C +++ b/gcc/testsuite/g++.dg/ext/complit8.C @@ -5,7 +5,7 @@ template<typename Entry> struct Array { Entry *array[32]; Array () : - array ( (Entry*[1]) { 0, 0 } ) // { dg-error "initializers|conversion" } + array ( (Entry*[1]) { 0, 0 } ) // { dg-error "initializers|incompatible" } {} }; diff --git a/gcc/testsuite/g++.dg/template/complit1.C b/gcc/testsuite/g++.dg/template/complit1.C index 00eb23e..218a7c9 100644 --- a/gcc/testsuite/g++.dg/template/complit1.C +++ b/gcc/testsuite/g++.dg/template/complit1.C @@ -6,6 +6,6 @@ template <int D> struct C { }; template<int D> -C<D>::C() : d((int[]){1,2,3}) {} +C<D>::C() : d((int[]){1,2,3}) {} // { dg-error "array" } template class C<1>; |