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

Kees Cook via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 09:54:06 PST 2024


kees wrote:

> Rather than have a `-f` flag to opt into this extension, I think instead you should just make it always available, then have tests that it can be used, but will trigger diagnostics under `-Wpedantic` since it's technically a language extension (IIUC).

I didn't do this because it seemed like this would change a lot of existing test cases, and past attempts at landing extensions to the C Standard (or even changes to existing extensions) seemed to get a lot of push-back when they weren't opt-in. And specifically for this feature, I, too, would prefer this was enabled by default, but given that there are _three_ different ways Clang already communicates why it should be considered bad syntax, it didn't seem a politically viable solution. An explicit opt-in knob seems the safest way to go.

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


More information about the cfe-commits mailing list