[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
Wed Mar 27 05:33:22 PDT 2024
https://github.com/AaronBallman approved this pull request.
I think the changes LGTM, but I do think we've got some more work to do to make this a first-class extension. For example, we lack constant expression support:
```
struct S { int y[]; };
constexpr struct S a1 = { 8, 12 };
```
gives:
```
C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.c:2:20: error: constexpr variable 'a1' must be initialized
by a constant expression
2 | constexpr struct S a1 = { 8, 12 };
| ^ ~~~~~~~~~
C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.c:2:27: note: flexible array initialization is not yet
supported
2 | constexpr struct S a1 = { 8, 12 };
| ^
1 error generated.
```
That said, I think this PR is incremental progress and I don't want to hold it up by expanding the scope.
https://github.com/llvm/llvm-project/pull/84428
More information about the cfe-commits
mailing list