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

--- Comment #7 from Will Wray <wjwray at gmail dot com> ---
The patch below fixes the main issue (I think, checking)
by adding first_initializer_p to the error condition
it errors only where designators are not allowed.


diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8a45411c995..f1210e862ca 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6835,7 +6835,7 @@ reshape_init_r (tree type, reshape_iter *d, tree
first_initializer_p,
         array types (one value per array element).  */
       if (TREE_CODE (stripped_str_init) == STRING_CST)
        {
-         if (has_designator_problem (d, complain))
+         if (first_initializer_p && has_designator_problem (d, complain))
            return error_mark_node;
          d->cur++;
          return str_init;

Reply via email to