1// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
3// rdar://16560476
4
5__attribute__((objc_subclassing_restricted))
6@interface Leaf // okay
7@end
8
9__attribute__((objc_subclassing_restricted))
10@interface SubClassOfLeaf : Leaf // expected-note {{class is declared here}}
11@end
12
13
14@interface SubClass : SubClassOfLeaf // expected-error {{cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute}}
15@end
16
17__attribute__((objc_root_class))
18@interface PlainRoot
19@end
20
21__attribute__((objc_subclassing_restricted))
22@interface Sub2Class : PlainRoot // okay
23@end
24
25// rdar://28753587
26__attribute__((objc_subclassing_restricted))
27@interface SuperImplClass // expected-note {{class is declared here}}
28@end
29@implementation SuperImplClass
30@end
31
32__attribute__((objc_subclassing_restricted))
33@interface SubImplClass : SuperImplClass
34@end
35@implementation SubImplClass // expected-error {{cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute}}
36@end
37