[clang] [Clang][Sema]: Allow flexible arrays in unions and alone in structs (PR #84428)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 09:57:20 PDT 2024


AaronBallman wrote:

> > [Since the C standard requires the test case to be diagnosed](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548#c3)
> 
> I wonder what part of the spec discusses this? Perhaps it's worth having the citation, just in case it helps revise the spec here one day.

C23 6.7.3.2p20: "As a special case, the last member of a structure with more than one named member may have an incomplete array type; this is called a flexible array member. ..."

It's explicitly saying the last member of a structure, not a structure or union.

(Note, I've yet to give this PR a thorough review, so this is intended to clarify rather than give a stance on anything.)

https://github.com/llvm/llvm-project/pull/84428


More information about the cfe-commits mailing list