[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
Thu Mar 21 08:30:48 PDT 2024
kees wrote:
> > because we don't yet support non-zero initialization (as described in commit [5955a0f](https://github.com/llvm/llvm-project/commit/5955a0f9375a8c0b134eeb4a8de5155dcce7c94f))
>
> I'm confused. We support non-zero init, and there are tests for non-zero init in that commit. The commit message mentions dynamic initialization, but that's not non-zero; that's "requires code to run at program startup".
I guess I'm confused about this test:
```
// Flexible array initialization is currently not supported by constant
// evaluation. Make sure we emit an error message, for now.
constexpr A c = {1, 2, 3}; // expected-error {{constexpr variable 'c' must be initialized by a constant expression}}
```
Why is 1, 2, 3 not considered a constant expression here? (Am I confusing "integer constant expression" for something else?)
https://github.com/llvm/llvm-project/pull/84428
More information about the cfe-commits
mailing list