[clang] [llvm] [Clang] Fix definition of layout-compatible to ignore empty classes (PR #92103)

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 13:29:46 PDT 2024


MitalAshok wrote:

Clang only uses `Sema::isLayoutCompatible` in two places: to implement `__is_layout_compatible` and [Clang type safety checking attributes](https://clang.llvm.org/docs/AttributeReference.html#type-safety-checking), which warn if a pointer does not point to a layout compatible type. This only affects compiler warnings.

The type safety attributes were introduced by e4a5a90e8d6bc6a5ed0bf5f152a658c680b94867 and they were exposed as `__is_layout_compatible` by d5922cf72cc18a7ac9f7afd1941ee2f7773d8469 this February, so I don't think it was available in Clang 18

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


More information about the cfe-commits mailing list