[PATCH] D62988: Add an attribute to allow fields of non-trivial types in C unions

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 09:57:27 PDT 2019


rjmccall added a comment.

In D62988#1537401 <https://reviews.llvm.org/D62988#1537401>, @ahatanak wrote:

> In D62988#1537082 <https://reviews.llvm.org/D62988#1537082>, @rjmccall wrote:
>
> > Does this lead to C/C++ ABI mismatches?  Should we just honor this in C++ as well by ignoring it when deciding to delete special members?  Is taking such a general name a good idea if it's language-specific?  Richard, thoughts?
>
>
> This is a C-only attribute, so clang will emit a diagnostic (warning 'attribute ignored') if the attribute is used to annotate a member of a C++ union. I think that would be sufficient to prevent possible C/C++ ABI mismatches?


Is there a way to write a C++ union that would be ABI-compatible with a C union with this attribute?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62988





More information about the cfe-commits mailing list