| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
| 4 |
|
| 5 |
class Base { |
| 6 |
virtual ~Base(); |
| 7 |
#if __cplusplus <= 199711L |
| 8 |
// expected-note@-2 {{implicitly declared private here}} |
| 9 |
#else |
| 10 |
// expected-note@-4 {{overridden virtual function is here}} |
| 11 |
#endif |
| 12 |
}; |
| 13 |
|
| 14 |
struct Foo : public Base { |
| 15 |
#if __cplusplus <= 199711L |
| 16 |
// expected-error@-2 {{base class 'Base' has private destructor}} |
| 17 |
#else |
| 18 |
// expected-error@-4 {{deleted function '~Foo' cannot override a non-deleted function}} |
| 19 |
// expected-note@-5 3{{destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor}} |
| 20 |
#endif |
| 21 |
|
| 22 |
const int kBlah = 3; |
| 23 |
#if __cplusplus <= 199711L |
| 24 |
// expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}} |
| 25 |
#endif |
| 26 |
|
| 27 |
Foo(); |
| 28 |
}; |
| 29 |
|
| 30 |
struct Bar : public Foo { |
| 31 |
Bar() { } |
| 32 |
#if __cplusplus <= 199711L |
| 33 |
// expected-note@-2 {{implicit destructor for 'Foo' first required here}} |
| 34 |
#else |
| 35 |
// expected-error@-4 {{attempt to use a deleted function}} |
| 36 |
#endif |
| 37 |
}; |
| 38 |
|
| 39 |
struct Baz { |
| 40 |
Foo f; |
| 41 |
Baz() { } |
| 42 |
#if __cplusplus >= 201103L |
| 43 |
// expected-error@-2 {{attempt to use a deleted function}} |
| 44 |
#endif |
| 45 |
}; |