| 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 {{overridden virtual function is here}} |
| 20 | // expected-note@-6 3 {{destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor}} |
| 21 | #endif |
| 22 | |
| 23 | const int kBlah = 3; |
| 24 | #if __cplusplus <= 199711L |
| 25 | // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} |
| 26 | #endif |
| 27 | |
| 28 | Foo(); |
| 29 | }; |
| 30 | |
| 31 | struct Bar : public Foo { |
| 32 | #if __cplusplus >= 201103L |
| 33 | // expected-error@-2 {{non-deleted function '~Bar' cannot override a deleted function}} |
| 34 | // expected-note@-3 {{while declaring the implicit destructor for 'Bar'}} |
| 35 | #endif |
| 36 | Bar() { } |
| 37 | #if __cplusplus <= 199711L |
| 38 | // expected-note@-2 {{implicit destructor for 'Foo' first required here}} |
| 39 | #else |
| 40 | // expected-error@-4 {{attempt to use a deleted function}} |
| 41 | #endif |
| 42 | }; |
| 43 | |
| 44 | struct Baz { |
| 45 | Foo f; |
| 46 | Baz() { } |
| 47 | #if __cplusplus >= 201103L |
| 48 | // expected-error@-2 {{attempt to use a deleted function}} |
| 49 | #endif |
| 50 | }; |
| 51 | |