aaron.ballman added a comment.

In D114080#3137462 <https://reviews.llvm.org/D114080#3137462>, @Naghasan wrote:

> right, TIL `sizeof (ContainsArr)` is 0 according to clang. I can see trouble 
> arising.
>
> @aaron.ballman maybe you know better, is that intended for the extension ?

I don't *know*, but I have two educated guesses that it is intended. GCC 
compatibility (GCC also has this behavior) and the relationship between 
zero-sized array members and flexible array members. Clang allows a flexible 
array member to be used in a structure with no members and it behaves the same 
as a zero-sized array in a structure with no members: 
https://godbolt.org/z/Gx7ozxYKz


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114080/new/

https://reviews.llvm.org/D114080

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to