1 // RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks -Warc-abi %s
3 // Classes that have an Objective-C object pointer.
4 struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
8 struct HasObjectMember1 { // expected-warning{{'HasObjectMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
12 struct HasObjectMember2 { // expected-warning{{'HasObjectMember2' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
16 // Don't complain if the type has non-external linkage
18 struct HasObjectMember3 {
23 // Don't complain if the Objective-C pointer type was explicitly given
25 struct HasObjectMember3 {
26 __unsafe_unretained id x[3][2];
29 struct HasBlockPointerMember0 { // expected-warning{{'HasBlockPointerMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
33 struct HasBlockPointerMember1 { // expected-warning{{'HasBlockPointerMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
38 NonPOD(const NonPOD&);
41 struct HasObjectMemberAndNonPOD0 { // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
42 // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
47 struct HasObjectMemberAndNonPOD1 { // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
48 // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
53 struct HasObjectMemberAndNonPOD2 { // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
54 // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
59 struct HasObjectMemberAndNonPOD3 {
60 HasObjectMemberAndNonPOD3 &operator=(const HasObjectMemberAndNonPOD3&);
61 ~HasObjectMemberAndNonPOD3();
66 struct HasBlockPointerMemberAndNonPOD0 { // expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
67 // expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
72 struct HasBlockPointerMemberAndNonPOD1 { // expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
73 // expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
78 int check_non_pod_objc_pointer0[__is_pod(id)? 1 : -1];
79 int check_non_pod_objc_pointer1[__is_pod(__strong id)? -1 : 1];
80 int check_non_pod_objc_pointer2[__is_pod(__unsafe_unretained id)? 1 : -1];
81 int check_non_pod_objc_pointer3[__is_pod(id[2][3])? 1 : -1];
82 int check_non_pod_objc_pointer4[__is_pod(__unsafe_unretained id[2][3])? 1 : -1];
83 int check_non_pod_block0[__is_pod(int (^)(int))? 1 : -1];
84 int check_non_pod_block1[__is_pod(int (^ __unsafe_unretained)(int))? 1 : -1];
86 struct FlexibleArrayMember0 {
88 id array[]; // expected-error{{flexible array member 'array' of non-POD element type 'id __strong[]'}}
91 struct FlexibleArrayMember1 {
93 __unsafe_unretained id array[];
96 // It's okay to pass a retainable type through an ellipsis.
98 void test_variadic() {
99 variadic(1, 17, @"Foo");
102 // It's okay to create a VLA of retainable types.