aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c8
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)