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