xref: /llvm-project/clang/test/SemaObjC/Inputs/non-trivial-c-union.h (revision 3f2c9917a4310a2835ffcc5a7be6226d0d218682)
1 // For backward compatibility, fields of C unions declared in system headers
2 // that have non-trivial ObjC ownership qualifications are marked as unavailable
3 // unless the qualifier is explicit and __strong.
4 
5 #pragma clang system_header
6 
7 typedef __strong id StrongID;
8 
9 typedef union {
10   id f0;
11   _Nonnull id f1;
12   __weak id f2;
13   StrongID f3;
14 } U0_SystemHeader;
15 
16 typedef union { // expected-note {{'U1_SystemHeader' has subobjects that are non-trivial to destruct}} expected-note {{'U1_SystemHeader' has subobjects that are non-trivial to copy}}
17   __strong id f0; // expected-note {{f0 has type '__strong id' that is non-trivial to destruct}} expected-note {{f0 has type '__strong id' that is non-trivial to copy}}
18   _Nonnull id f1;
19 } U1_SystemHeader;
20