It was rejected in C, and in a strange way accepted in C++. However, the
support was never properly tested and fully implemented, so just reject
it in C++ mode as well.
This change also fixes crash on attempt to initialize union with flexible
array member. Due to missing check on union, there was a null expression
added to init list that caused crash later.
Just for some context, numStructUnionElements checks that there is a flexible array member and returns number_of_initializable_fields-1 for structs. For unions it just returns 1 or 0, so flexible array member caused adding one more element to initlistexpr that was never properly handled.
Instead of doing this change, we could probably never enter initialization since the record (union) declaration is not valid, but that is not the case even for other types of errors in code, for example, I've tried declaring field of struct with a typo:
Initialization is still performed by clang.
Also, it seems MSVC considers flexible array member inside union as valid, so the test code is probably not always invalid.