]> git.saurik.com Git - apple/objc4.git/blob - test/badTagClass.m
objc4-646.tar.gz
[apple/objc4.git] / test / badTagClass.m
1 /*
2 TEST_CRASHES
3 TEST_RUN_OUTPUT
4 objc\[\d+\]: tag index 7 used for two different classes \(was 0x[0-9a-fA-F]+ NSObject, now 0x[0-9a-fA-F]+ TestRoot\)
5 CRASHED: SIG(ILL|TRAP)
6 OR
7 no tagged pointers
8 OK: badTagClass.m
9 END
10 */
11
12 #include "test.h"
13 #include "testroot.i"
14
15 #include <objc/objc-internal.h>
16 #include <objc/Protocol.h>
17
18 #if OBJC_HAVE_TAGGED_POINTERS
19
20 int main()
21 {
22 // re-registration and nil registration allowed
23 _objc_registerTaggedPointerClass(OBJC_TAG_7, [NSObject class]);
24 _objc_registerTaggedPointerClass(OBJC_TAG_7, [NSObject class]);
25 _objc_registerTaggedPointerClass(OBJC_TAG_7, nil);
26 _objc_registerTaggedPointerClass(OBJC_TAG_7, [NSObject class]);
27
28 // colliding registration disallowed
29 _objc_registerTaggedPointerClass(OBJC_TAG_7, [TestRoot class]);
30
31 fail(__FILE__);
32 }
33
34 #else
35
36 int main()
37 {
38 fprintf(stderr, "no tagged pointers\n");
39 succeed(__FILE__);
40 }
41
42 #endif