diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-12-07 21:43:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-12-07 21:43:06 +0100 |
commit | 6f8e335e64fdac2f205714e2ccda0df654f3cdb9 (patch) | |
tree | d785b96dbf47464fb3dd0f3a5aea61925e294546 /gcc/cp/decl.c | |
parent | 14b1860e4e982d27e6669621c105e72d6c8bff41 (diff) | |
download | gcc-6f8e335e64fdac2f205714e2ccda0df654f3cdb9.zip gcc-6f8e335e64fdac2f205714e2ccda0df654f3cdb9.tar.gz gcc-6f8e335e64fdac2f205714e2ccda0df654f3cdb9.tar.bz2 |
re PR c++/51229 ([C++0x] [4.7 Regression] Broken diagnostic: 'integer_cst' not supported by dump_dec)
PR c++/51229
* decl.c (reshape_init_class): Complain if d->cur->index is
INTEGER_CST.
* parser.c (cp_parser_initializer_list): If cp_parser_parse_definitely
fails, clear designator.
* g++.dg/ext/desig3.C: New test.
From-SVN: r182088
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 055c1b2..07cc9e6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5078,6 +5078,14 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p, /* Handle designated initializers, as an extension. */ if (d->cur->index) { + if (TREE_CODE (d->cur->index) == INTEGER_CST) + { + if (complain & tf_error) + error ("%<[%E] =%> used in a GNU-style designated initializer" + " for class %qT", d->cur->index, type); + return error_mark_node; + } + field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); if (!field || TREE_CODE (field) != FIELD_DECL) |