https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124415
Bug ID: 124415
Summary: Brace-init of GNU vector type member rejected while
other compilers accept it
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: attackerj1113 at gmail dot com
Target Milestone: ---
GCC rejects R g3{{}}; with an error that {} cannot be converted to V4, while
both Clang and EDG accept this code and treat the inner {} as
zero-initialization of the V4 element.
==========================================
typedef float __attribute__ ((vector_size (4 * sizeof (float)))) V4;
struct R {
typedef V4 Vec;
Vec axis[1];
constexpr R (V4 x)
: axis{x} {}
};
R g1{ V4{} }; // OK
R g2( V4{} ); // OK
R g3{{}}; // GCC ERROR
==========================================
https://godbolt.org/z/sxo74jWe1
it seems aggregate initialization of the Vec axis[1] member is handled more
strictly for GNU vector types than in other compilers. It would be good if R
g3{{}}; were accepted for consistency with those cases and with Clang/EDG.