blob: 698c103c3384bccc1fd913510cd00c664ddd3667 [file] [log] [blame]
/* APPLE LOCAL file radar 4592503 */
/* Check that gcc issues warning when __weak attribute is used unwisely. */
/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */
/* { dg-options "-fobjc-gc" } */
/* { dg-require-effective-target objc_gc } */
struct S {
__weak id p; /* { dg-warning "__weak attribute cannot be specified on a field declaration" } */
};
union U {
__weak id p; /* { dg-warning "__weak attribute cannot be specified on a field declaration" } */
};
__attribute__((objc_root_class)) @interface Foo {
struct {
__weak id i; /* { dg-warning "__weak attribute cannot be specified on a field declaration" } */
} IVAR;
union {
__weak id u; /* { dg-warning "__weak attribute cannot be specified on a field declaration" } */
} UVAR;
__weak id arr[3]; // ok
__weak id aok; // ok
}
@end
__weak id global; // ok
__weak id ggg = 0; // ok
static id ppp; // ok
extern __weak id ewid; // ok
int main ()
{
__weak id local; /* { dg-warning "__weak attribute cannot be specified on a local object declaration" } */
static __weak id s; // ok
extern __weak id e; // ok
}