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

ensadc at mailnesia dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ensadc at mailnesia dot com

--- Comment #4 from ensadc at mailnesia dot com ---
This is accepted in `-Wno-pedantic` mode:

    struct A { int x; char a[10]; };
    A a = { .x = 1, { .a = "aaaa" } }; // #1

This is rejected:

    struct A { int x; char a[10]; };
    A a = { .x = 1, .a = "aaaa" }; // #2

It seems that #1 should be rejected, and #2 should be accepted.

I suspect that the bug is related to r182391 (which is a fix for PR51458),
which added call to `has_designator_problem` in `reshape_init_r`:

      /* If it's a string literal, then it's the initializer for the array
         as a whole. Otherwise, continue with normal initialization for
         array types (one value per array element).  */
      if (TREE_CODE (stripped_str_init) == STRING_CST)
        {
          if (has_designator_problem (d, complain))
            return error_mark_node;
          d->cur++;
          return str_init;
        }

Reply via email to