2012-09-15 01:48:35 +08:00
|
|
|
// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks %s
|
2012-01-12 10:34:32 +08:00
|
|
|
// DISABLE: mingw32
|
2011-06-16 07:25:17 +08:00
|
|
|
|
|
|
|
// Classes that have an Objective-C object pointer.
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasObjectMember0 {
|
2011-06-16 07:25:17 +08:00
|
|
|
id x;
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasObjectMember1 {
|
2011-06-16 07:25:17 +08:00
|
|
|
id x[3];
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasObjectMember2 {
|
2011-06-16 07:25:17 +08:00
|
|
|
id x[3][2];
|
|
|
|
};
|
|
|
|
|
|
|
|
// Don't complain if the type has non-external linkage
|
|
|
|
namespace {
|
|
|
|
struct HasObjectMember3 {
|
|
|
|
id x[3][2];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Don't complain if the Objective-C pointer type was explicitly given
|
|
|
|
// no lifetime.
|
|
|
|
struct HasObjectMember3 {
|
|
|
|
__unsafe_unretained id x[3][2];
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasBlockPointerMember0 {
|
2011-06-16 07:25:17 +08:00
|
|
|
int (^bp)(int);
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasBlockPointerMember1 {
|
2011-06-16 07:25:17 +08:00
|
|
|
int (^bp[2][3])(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NonPOD {
|
|
|
|
NonPOD(const NonPOD&);
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasObjectMemberAndNonPOD0 {
|
2011-06-16 07:25:17 +08:00
|
|
|
id x;
|
|
|
|
NonPOD np;
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasObjectMemberAndNonPOD1 {
|
2011-06-16 07:25:17 +08:00
|
|
|
NonPOD np;
|
|
|
|
id x[3];
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasObjectMemberAndNonPOD2 {
|
2011-06-16 07:25:17 +08:00
|
|
|
NonPOD np;
|
|
|
|
id x[3][2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct HasObjectMemberAndNonPOD3 {
|
|
|
|
HasObjectMemberAndNonPOD3 &operator=(const HasObjectMemberAndNonPOD3&);
|
|
|
|
~HasObjectMemberAndNonPOD3();
|
|
|
|
NonPOD np;
|
|
|
|
id x[3][2];
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasBlockPointerMemberAndNonPOD0 {
|
2011-06-16 07:25:17 +08:00
|
|
|
NonPOD np;
|
|
|
|
int (^bp)(int);
|
|
|
|
};
|
|
|
|
|
2012-09-15 01:48:35 +08:00
|
|
|
struct HasBlockPointerMemberAndNonPOD1 {
|
2011-06-16 07:25:17 +08:00
|
|
|
NonPOD np;
|
|
|
|
int (^bp[2][3])(int);
|
|
|
|
};
|
|
|
|
|
2011-07-13 01:28:52 +08:00
|
|
|
int check_non_pod_objc_pointer0[__is_pod(id)? 1 : -1];
|
2011-06-16 07:25:17 +08:00
|
|
|
int check_non_pod_objc_pointer1[__is_pod(__strong id)? -1 : 1];
|
|
|
|
int check_non_pod_objc_pointer2[__is_pod(__unsafe_unretained id)? 1 : -1];
|
2011-07-13 01:28:52 +08:00
|
|
|
int check_non_pod_objc_pointer3[__is_pod(id[2][3])? 1 : -1];
|
2011-06-16 07:25:17 +08:00
|
|
|
int check_non_pod_objc_pointer4[__is_pod(__unsafe_unretained id[2][3])? 1 : -1];
|
2011-07-13 01:28:52 +08:00
|
|
|
int check_non_pod_block0[__is_pod(int (^)(int))? 1 : -1];
|
2011-06-16 07:25:17 +08:00
|
|
|
int check_non_pod_block1[__is_pod(int (^ __unsafe_unretained)(int))? 1 : -1];
|
|
|
|
|
|
|
|
struct FlexibleArrayMember0 {
|
|
|
|
int length;
|
|
|
|
id array[]; // expected-error{{flexible array member 'array' of non-POD element type 'id __strong[]'}}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FlexibleArrayMember1 {
|
|
|
|
int length;
|
|
|
|
__unsafe_unretained id array[];
|
|
|
|
};
|
|
|
|
|
|
|
|
// It's okay to pass a retainable type through an ellipsis.
|
|
|
|
void variadic(...);
|
|
|
|
void test_variadic() {
|
|
|
|
variadic(1, 17, @"Foo");
|
|
|
|
}
|
|
|
|
|
|
|
|
// It's okay to create a VLA of retainable types.
|
|
|
|
void vla(int n) {
|
|
|
|
id vla[n];
|
|
|
|
}
|