1*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s 2*67e74705SXin Listatic id __attribute((objc_gc(weak))) a; 3*67e74705SXin Listatic id __attribute((objc_gc(strong))) b; 4*67e74705SXin Li 5*67e74705SXin Listatic id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires a string}} 6*67e74705SXin Listatic id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires a string}} 7*67e74705SXin Listatic id __attribute((objc_gc(foo, 456))) e; // expected-error{{'objc_gc' attribute takes one argument}} 8*67e74705SXin Listatic id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}} 9*67e74705SXin Li 10*67e74705SXin Listatic int __attribute__((objc_gc(weak))) g; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}} 11*67e74705SXin Li 12*67e74705SXin Listatic __weak int h; // expected-warning {{'__weak' only applies to Objective-C object or block pointer types; type here is 'int'}} 13*67e74705SXin Li 14*67e74705SXin Li// TODO: it would be great if this reported as __weak 15*67e74705SXin Li#define WEAK __weak 16*67e74705SXin Listatic WEAK int h; // expected-warning {{'objc_ownership' only applies to Objective-C object or block pointer types; type here is 'int'}} 17*67e74705SXin Li 18*67e74705SXin Li/* expected-warning {{'__weak' only applies to Objective-C object or block pointer types; type here is 'int'}}*/ static __we\ 19*67e74705SXin Liak int i; 20*67e74705SXin Li 21*67e74705SXin Li// rdar://problem/9126213 22*67e74705SXin Livoid test2(id __attribute((objc_gc(strong))) *strong, 23*67e74705SXin Li id __attribute((objc_gc(weak))) *weak) { 24*67e74705SXin Li void *opaque; 25*67e74705SXin Li opaque = strong; 26*67e74705SXin Li strong = opaque; 27*67e74705SXin Li 28*67e74705SXin Li opaque = weak; 29*67e74705SXin Li weak = opaque; 30*67e74705SXin Li} 31