As reference Incompatibilities Between ISO C and ISO C++ states in Flexible array members section:
C++ does not support flexible array members.
(This feature might be provided as an extension by some C++ compilers, but would probably be valid only for POD structure types.)
gcc does support this as an extension as well as clang. Apparently this also works in Visual Studio - see it live if you don't use /Za
which I can find any documentation on besides this post by Stephan T. Lavavej.
I don't think there is a portable way to silence the warning, but something like Partially disable pedantic warnings in gcc within source should work for gcc
.