1 /* Contributed by Iain Sandoe <iain@sandoe.co.uk>, May 2019. */
2 /* { dg-do compile } */
4 /* Basic check of parsing instancetype. */
6 extern id class_createInstance (id, int);
7 extern id class_getSuperclass (id);
9 #if defined(__has_attribute) && __has_attribute(objc_root_class)
10 __attribute__((objc_root_class))
16 + (instancetype)alloc;
18 + (instancetype)initialize;
19 + (instancetype)factoryMethodA;
25 @implementation MyObject
26 + (instancetype)alloc { return class_createInstance (self, 0); }
27 - (instancetype)init { return self; }
28 + (instancetype)initialize { return self; }
29 + (instancetype)factoryMethodA { return [[[self class] alloc] init]; }
30 + (id)factoryMethodB { return [[[self class] alloc] init]; }
31 + (Class) class { return self; }
32 + (Class) superclass { return class_getSuperclass (self); }