OSDN Git Service

2011-10-18 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / proto-lossage-3.m
1 /* Crash due to descriptionFor(Instance|Class)Method applied to
2    a protocol with no instance/class methods respectively.
3    Problem report and original fix by richard@brainstorm.co.uk.  */
4 /* { dg-do run } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6 #include <objc/objc.h>
7 #include "../objc-obj-c++-shared/runtime.h"
8
9 @interface MyClass
10 - name;
11 @end
12
13 @protocol NoInstanceMethods
14 + testMethod;
15 @end
16
17 @protocol NoClassMethods
18 - testMethod;
19 @end
20
21 int
22 main()
23 {
24 protocol_getMethodDescription (@protocol(NoInstanceMethods), @selector(name), YES, YES);
25 protocol_getMethodDescription (@protocol(NoInstanceMethods), @selector(name), YES, NO);
26 protocol_getMethodDescription (@protocol(NoClassMethods), @selector(name), YES, YES);
27 protocol_getMethodDescription (@protocol(NoClassMethods), @selector(name), YES, NO);
28 return 0;
29 }