46 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5class Base {6 virtual ~Base();7#if __cplusplus <= 199711L8 // expected-note@-2 {{implicitly declared private here}}9#else10 // expected-note@-4 {{overridden virtual function is here}}11#endif12};13 14struct Foo : public Base {15#if __cplusplus <= 199711L16// expected-error@-2 {{base class 'Base' has private destructor}}17#else18// 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#endif21 22 const int kBlah = 3;23#if __cplusplus <= 199711L24 // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}25#endif26 27 Foo();28};29 30struct Bar : public Foo {31 Bar() { }32#if __cplusplus <= 199711L33 // expected-note@-2 {{implicit destructor for 'Foo' first required here}}34#else35 // expected-error@-4 {{attempt to use a deleted function}}36#endif37};38 39struct Baz {40 Foo f;41 Baz() { }42#if __cplusplus >= 201103L43 // expected-error@-2 {{attempt to use a deleted function}}44#endif45};46