Debian Codegraph @

gcc/testsuite/objc.dg/pr23214.m

raw
1 /* Test that there is no problem initializing multiple static
2 Protocol instances. */
3
4 /* { dg-do run } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6 /* { dg-additional-options "-framework Foundation" { target { { *-*-darwin* } && objc2 } } } */
7
8 #if defined (__NEXT_RUNTIME__) && defined(__OBJC2__) \
9 && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \
10 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1080
11 #include <objc/Protocol.h>
12 #define OBJECT NSObject
13 #else
14 #include <objc/Object.h>
15 #define OBJECT Object
16 #include <objc/Protocol.h>
17 #endif
18
19 @interface OBJECT (TS_CAT)
20 - test;
21 @end
22
23 @implementation OBJECT (TS_CAT)
24 - test { return self; }
25 @end
26
27 @protocol A
28 @end
29
30 @protocol B
31 @end
32
33 @interface Dummy : OBJECT <B>
34 @end
35
36 int main ()
37 {
38 [@protocol(A) test];
39 [@protocol(B) test];
40
41 return 0;
42 }
43
44 @implementation Dummy
45 @end