aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc/execute/object_is_meta_class.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/objc/execute/object_is_meta_class.m')
-rw-r--r--gcc-4.9/gcc/testsuite/objc/execute/object_is_meta_class.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/objc/execute/object_is_meta_class.m b/gcc-4.9/gcc/testsuite/objc/execute/object_is_meta_class.m
new file mode 100644
index 000000000..217873f53
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/objc/execute/object_is_meta_class.m
@@ -0,0 +1,42 @@
+/* Contributed by Nicola Pero - Tue Jul 3 10:55:21 BST 2001 */
+
+#include "../../objc-obj-c++-shared/runtime.h"
+#include "../../objc-obj-c++-shared/TestsuiteObject.m"
+
+/* This test demonstrate a failure in object_is_meta_class which was fixed */
+
+@interface EvilClass : TestsuiteObject
+{
+ Class super_class;
+ const char* name;
+ long version;
+ unsigned long info;
+}
+@end
+
+@implementation EvilClass
+- (id) init
+{
+ self = [super init];
+ /* The following one is used in the runtime to mark meta classes */
+ info = 0x2L;
+ return self;
+}
+@end
+
+int main (void)
+{
+ /* Create an object of our EvilClass */
+ EvilClass *evilObject = [EvilClass new];
+
+ /* Now check that the object is not a meta class object */
+ if (class_isMetaClass (object_getClass (evilObject))
+ && class_isMetaClass (evilObject))
+ {
+ printf ("object_is_meta_class failed\n");
+ abort ();
+ }
+
+ return 0;
+}
+