rsmith added a comment.

How do you write correct (non-leaking, non-double-freeing, 
non-releasing-invalid-pointers) code with this attribute? For example, suppose 
I have a `__strong` union member: does storing to it release the old value 
(which might be a different union member)? If so, how do you work around that? 
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#ownership-qualified-fields-of-structs-and-unions
 should be updated to say what happens. If manual reference counting code is 
required to make any use of this feature correct (which seems superficially 
likely), is this a better programming model than `__unsafe_unretained`?

Unions with non-trivial members are only permitted in C++11 onwards; should we 
allow the attribute in C++98 mode? But more than that, unions with non-trivial 
members require user-provided special members in C++11 onwards, meaning that a 
union using this attribute in C would have a different calling convention than 
the "natural" equivalent in C++. So I'm also wondering if we should allow this 
in all language modes.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62988



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

Reply via email to