1// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks %s 2// DISABLE: mingw32 3 4// Classes that have an Objective-C object pointer. 5struct HasObjectMember0 { 6 id x; 7}; 8 9struct HasObjectMember1 { 10 id x[3]; 11}; 12 13struct HasObjectMember2 { 14 id x[3][2]; 15}; 16 17// Don't complain if the type has non-external linkage 18namespace { 19 struct HasObjectMember3 { 20 id x[3][2]; 21 }; 22} 23 24// Don't complain if the Objective-C pointer type was explicitly given 25// no lifetime. 26struct HasObjectMember3 { 27 __unsafe_unretained id x[3][2]; 28}; 29 30struct HasBlockPointerMember0 { 31 int (^bp)(int); 32}; 33 34struct HasBlockPointerMember1 { 35 int (^bp[2][3])(int); 36}; 37 38struct NonPOD { 39 NonPOD(const NonPOD&); 40}; 41 42struct HasObjectMemberAndNonPOD0 { 43 id x; 44 NonPOD np; 45}; 46 47struct HasObjectMemberAndNonPOD1 { 48 NonPOD np; 49 id x[3]; 50}; 51 52struct HasObjectMemberAndNonPOD2 { 53 NonPOD np; 54 id x[3][2]; 55}; 56 57struct HasObjectMemberAndNonPOD3 { 58 HasObjectMemberAndNonPOD3 &operator=(const HasObjectMemberAndNonPOD3&); 59 ~HasObjectMemberAndNonPOD3(); 60 NonPOD np; 61 id x[3][2]; 62}; 63 64struct HasBlockPointerMemberAndNonPOD0 { 65 NonPOD np; 66 int (^bp)(int); 67}; 68 69struct HasBlockPointerMemberAndNonPOD1 { 70 NonPOD np; 71 int (^bp[2][3])(int); 72}; 73 74int check_non_pod_objc_pointer0[__is_pod(id)? 1 : -1]; 75int check_non_pod_objc_pointer1[__is_pod(__strong id)? -1 : 1]; 76int check_non_pod_objc_pointer2[__is_pod(__unsafe_unretained id)? 1 : -1]; 77int check_non_pod_objc_pointer3[__is_pod(id[2][3])? 1 : -1]; 78int check_non_pod_objc_pointer4[__is_pod(__unsafe_unretained id[2][3])? 1 : -1]; 79int check_non_pod_block0[__is_pod(int (^)(int))? 1 : -1]; 80int check_non_pod_block1[__is_pod(int (^ __unsafe_unretained)(int))? 1 : -1]; 81 82struct FlexibleArrayMember0 { 83 int length; 84 id array[]; // expected-error{{flexible array member 'array' of non-POD element type 'id __strong[]'}} 85}; 86 87struct FlexibleArrayMember1 { 88 int length; 89 __unsafe_unretained id array[]; 90}; 91 92// It's okay to pass a retainable type through an ellipsis. 93void variadic(...); 94void test_variadic() { 95 variadic(1, 17, @"Foo"); 96} 97 98// It's okay to create a VLA of retainable types. 99void vla(int n) { 100 id vla[n]; 101} 102