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
55 [[clang::always_destroy
]] A a
; // no warning
58 [[clang::always_destroy
]] static A a
; // no warning
63 #if __cplusplus >= 202002L
64 #define CPP20_CONSTEXPR constexpr
66 #define CPP20_CONSTEXPR
69 CPP20_CONSTEXPR
~S() {}
71 S s
; // cxx11-warning {{exit-time destructor}}
74 CPP20_CONSTEXPR
~T() { if (b
) {} }
77 T t
; // expected-warning {{exit-time destructor}}
78 #undef CPP20_CONSTEXPR