OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / proto-lossage-7.m
1 /* Check that typedefs of ObjC classes preserve 
2    any @protocol qualifiers.  */
3 /* { dg-do compile } */
4
5 #ifdef __NEXT_RUNTIME__
6 #include <Foundation/NSObject.h>
7 #define OBJECT NSObject
8 #else
9 #include <objc/Object.h>
10 #define OBJECT Object
11 #endif
12
13 @protocol CanDoStuff;
14
15 typedef OBJECT<CanDoStuff> CanDoStuffType;
16 typedef OBJECT<CanDoStuff> *CanDoStuffTypePtr;
17
18 @protocol CanDoStuff
19 - (int) dostuff;
20 @end
21
22 @protocol MoreStuff
23 - (int) morestuff;
24 @end
25
26 int main(void)
27 {
28     CanDoStuffTypePtr  dice     = nil;
29     CanDoStuffType    *nodice   = nil;
30     int count;
31     count = [dice dostuff];
32     count = [nodice dostuff];
33     return 0;
34 }
35