1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wexit-time-destructors %s -verify=expected,cxx11
2 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -Wexit-time-destructors %s -verify=expected
6 A a
; // expected-warning {{declaration requires an exit-time destructor}}
7 A b
[10]; // expected-warning {{declaration requires an exit-time destructor}}
8 A c
[10][10]; // expected-warning {{declaration requires an exit-time destructor}}
17 struct A
{ ~A() { } };
19 static A a
; // expected-warning {{declaration requires an exit-time destructor}}
20 static A b
[10]; // expected-warning {{declaration requires an exit-time destructor}}
21 static A c
[10][10]; // expected-warning {{declaration requires an exit-time destructor}}
25 static A
&f
= c
[5][7];
30 struct A
{ ~A() = default; };
34 struct C
: B
{ ~C() = default; };
35 C c
; // expected-warning {{exit-time destructor}}
50 [[clang::no_destroy
]] A a
; // no warning
54 #if __cplusplus >= 202002L
55 #define CPP20_CONSTEXPR constexpr
57 #define CPP20_CONSTEXPR
60 CPP20_CONSTEXPR
~S() {}
62 S s
; // cxx11-warning {{exit-time destructor}}
65 CPP20_CONSTEXPR
~T() { if (b
) {} }
68 T t
; // expected-warning {{exit-time destructor}}
69 #undef CPP20_CONSTEXPR