summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/property/at-property-21.m
blob: d1f54b1cda8e24396157827b1b74098aff4b5848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
/* { dg-do compile } */

#include <objc/objc.h>

@protocol MyProtocol
- (void) message;
@end

@interface MyRootClass
{
  Class isa;
}

/* Test the warnings on 'assign' with protocols.  */
@property id <MyProtocol> property_a;      /* { dg-warning "object property .property.a. has no .assign., .retain. or .copy. attribute" } */
			                   /* { dg-message ".assign. can be unsafe for Objective-C objects" "" { target *-*-* } 16 } */

@property MyRootClass <MyProtocol> *property_b; /* { dg-warning "object property .property.b. has no .assign., .retain. or .copy. attribute" } */
			                        /* { dg-message ".assign. can be unsafe for Objective-C objects" "" { target *-*-* } 19 } */

@property Class <MyProtocol> property_c;   /* No 'assign' warning (Classes are static objects so assign semantics do not matter for them). */
@end