abstract-class-type-ivar.mm revision 8540b6e778545008fd521b002929b89ce10506ce
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2// rdar://12095239
3// rdar://14261999
4
5class CppAbstractBase {
6public:
7    virtual void testA() = 0;
8    virtual void testB() = 0; // expected-note {{unimplemented pure virtual method 'testB' in 'CppConcreteSub}}
9    int a;
10};
11
12class CppConcreteSub : public CppAbstractBase {
13    virtual void testA() { }
14};
15
16@interface Objc  {
17    CppConcreteSub _concrete; // expected-error{{instance variable type 'CppConcreteSub' is an abstract class}}
18}
19- (CppAbstractBase*)abstract;
20@property (nonatomic, readonly) const CppConcreteSub& Prop;  // expected-note {{property declared here}}
21@end
22
23@implementation Objc
24- (CppAbstractBase*)abstract {
25    return &_concrete;
26}
27@synthesize Prop; // expected-error {{synthesized instance variable type 'const CppConcreteSub' is an abstract class}}
28@end
29
30class Cpp {
31public:
32    CppConcreteSub sub; // expected-error {{field type 'CppConcreteSub' is an abstract class}}
33};
34