diff options
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index b4b6cdb0a4c..47428b96f3d 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -800,6 +800,14 @@ perform_member_init (tree member, tree init) in that case. */ init = build_x_compound_expr_from_list (init, ELK_MEM_INIT, tf_warning_or_error); + if (TREE_CODE (type) == ARRAY_TYPE + && TYPE_DOMAIN (type) == NULL_TREE + && init != NULL_TREE) + { + error_at (DECL_SOURCE_LOCATION (current_function_decl), + "member initializer for flexible array member"); + inform (DECL_SOURCE_LOCATION (member), "%q#D initialized", member); + } if (init) finish_expr_stmt (cp_build_modify_expr (input_location, decl, |