aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm
new file mode 100644
index 000000000..9c08f07e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm
@@ -0,0 +1,29 @@
+/* Crash due to descriptionFor(Instance|Class)Method applied to
+ a protocol with no instance/class methods respectively.
+ Problem report and original fix by richard@brainstorm.co.uk. */
+/* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+#include <objc/Protocol.h>
+#include "../objc-obj-c++-shared/runtime.h"
+
+@interface MyClass
+- name;
+@end
+
+@protocol NoInstanceMethods
++ testMethod;
+@end
+
+@protocol NoClassMethods
+- testMethod;
+@end
+
+int
+main()
+{
+protocol_getMethodDescription (@protocol(NoInstanceMethods), @selector(name), YES, YES);
+protocol_getMethodDescription (@protocol(NoInstanceMethods), @selector(name), YES, NO);
+protocol_getMethodDescription (@protocol(NoClassMethods), @selector(name), YES, YES);
+protocol_getMethodDescription (@protocol(NoClassMethods), @selector(name), YES, NO);
+return 0;
+}