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

--- Comment #10 from Will Wray <wjwray at gmail dot com> ---
Note that the initialization of 'c0' takes a different codepath:

    struct C {char a[2];};

    C c0{.a="a"};           // [dcl.init.aggr]
    C c1{.a=""};
    C c2{.a={"a"}};
    C c3{.a={""}};

c1, c2 and c3 are all dealt with under the condition:

    if (TREE_CODE (type) == ARRAY_TYPE
        ...

c0 is dealt with by the immediately preceding [dcl.init.aggr] condition:

    if ((TREE_CODE (init) != CONSTRUCTOR || COMPOUND_LITERAL_P (init))
        ...

Is this a problem? It seems surprising.

If the two condition blocks were switched so the ARRAY_TYPE check comes first
then all initializations would follow the same codepath in reshape_init_r

Reply via email to