MitalAshok wrote:

Is this the expected behaviour:

```c++
struct EmptyPadding : Empty { Empty e; int X; };
struct Repeated : Empty, DerivedEmpty { int X; }; // expected-warning 
{{inaccessible due to ambiguity}}
_Static_assert(sizeof(EmptyPadding) == 8, "");
_Static_assert(sizeof(Repeated) == 8, "");
_Static_assert(sizeof(NotEmpty) == 4, "");
_Static_assert(__is_scalarized_layout_compatible(EmptyPadding, NotEmpty), "");
_Static_assert(__is_scalarized_layout_compatible(Repeated, NotEmpty), "");
```

I.e., is the "scalarization" expected to get rid of padding? A similar issue 
happens with padding introduced by over-alignment.

Also see 
https://github.com/llvm/llvm-project/issues/98310#issuecomment-2248326726: This 
might need to be renamed to `__builtin_is_scalarized_layout_compatible` to be 
consistent with new type traits. Unsure if this applies to HLSL or Clang-only 
extensions (I'll ask for confirmation), but the logic is that standard 
libraries can use `__is_scalarized_layout_compatible` and the compiler provides 
`__builtin_is_scalarized_layout_compatible`.

https://github.com/llvm/llvm-project/pull/102227
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to