[clang] [clang] Reject VLAs in `__is_layout_compatible()` (PR #87737)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 05:23:51 PDT 2024


philnik777 wrote:

I think clang should reject incomplete types when the standard says so. It doesn't seem particularly useful to accept some special cases but reject incomplete types in general. All the traits should probably be audited once. It looks like Clang has other problematic cases: https://godbolt.org/z/hajWfq7a6

I don't really care whether Clang should reject VLAs when using the builtin, since the trait will be used through some template and that's rejected that anyways. FWIW it'd be more consistent, since in my mind `__some_type_trait(T, U)` behaves the same as `std::some_type_trait_v<T, U>`.

Flexible arrays are accepted because they are arrays of unknown bounds in the type system, which is part of the standard. The extension is only that they aren't rejected at the end of a struct and have some special meaning there. They should definitely not be rejected.


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


More information about the cfe-commits mailing list