This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/72775] [6/7 Regression] internal compiler error: in finish_expr_stmt, at cp/semantics.c:677


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72775

--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This patch seems to disable initialization of a flexible array member in a
constructor, and, curiously, doesn't regress anything in C++ dg.exp.

--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -800,6 +800,11 @@ 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);
+      else if (TREE_CODE (type) == ARRAY_TYPE
+          && TYPE_DOMAIN (type) == NULL_TREE
+          && DECL_CONSTRUCTOR_P (current_function_decl))
+   error_at (DECL_SOURCE_LOCATION (member),
+         "initialization of a flexible array member in a constructor");

       if (init)
    finish_expr_stmt (cp_build_modify_expr (input_location, decl,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]