Merged r157653 through r157895 into branch.
[official-gcc.git] / gcc / testsuite / objc / execute / formal_protocol-5.m
blob8bb63ecfa662a8d02cea8d1b3b30edf489dc2c92
1 /* Contributed by Nicola Pero - Fri Mar  9 21:35:47 CET 2001 */
3 #include <stdlib.h>
4 #include "../../objc-obj-c++-shared/Protocol1.h"
6 /* Test defining a protocol, and accessing it using @protocol */
8 @protocol Evaluating
9 - (int) importance;
10 @end
12 /* A class adopting the protocol */
13 @interface Test <Evaluating>
14 @end
16 @implementation Test
17 - (int) importance
19   return 1000;
21 @end
23 int main (void)
25   Protocol *protocol = @protocol (Evaluating);
27 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
28   if (strcmp (protocol_getName(protocol), "Evaluating"))
29 #else
30   if (strcmp ([protocol name], "Evaluating"))
31 #endif
32     {
33       abort ();
34     }
36   return 0;