1 // RUN: %clang_cc1 -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 {
f()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