1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wexit-time-destructors %s -verify 2 3 namespace test1 { 4 struct A { ~A(); }; 5 A a; // expected-warning {{declaration requires an exit-time destructor}} 6 A b[10]; // expected-warning {{declaration requires an exit-time destructor}} 7 A c[10][10]; // expected-warning {{declaration requires an exit-time destructor}} 8 9 A &d = a; 10 A &e = b[5]; 11 A &f = c[5][7]; 12 } 13 14 namespace test2 { 15 void f() { 16 struct A { ~A() { } }; 17 18 static A a; // expected-warning {{declaration requires an exit-time destructor}} 19 static A b[10]; // expected-warning {{declaration requires an exit-time destructor}} 20 static A c[10][10]; // expected-warning {{declaration requires an exit-time destructor}} 21 22 static A &d = a; 23 static A &e = b[5]; 24 static A &f = c[5][7]; 25 } 26 } 27 28 namespace test3 { 29 struct A { ~A() = default; }; 30 A a; 31 32 struct B { ~B(); }; 33 struct C : B { ~C() = default; }; 34 C c; // expected-warning {{exit-time destructor}} 35 36 class D { 37 friend struct E; 38 ~D() = default; 39 }; 40 struct E : D { 41 D d; 42 ~E() = default; 43 }; 44 E e; 45 } 46