1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
15 #include <type_traits>
18 #include "test_macros.h"
30 static bool dtor_called
;
32 X(const X
&) = default;
33 X
& operator=(const X
&) = default;
34 ~X() {dtor_called
= true;}
37 bool X::dtor_called
= false;
43 static_assert(std::is_trivially_destructible
<T
>::value
, "");
44 static_assert(std::is_trivially_destructible
<optional
<T
>>::value
, "");
48 static_assert(std::is_trivially_destructible
<T
>::value
, "");
49 static_assert(std::is_trivially_destructible
<optional
<T
>>::value
, "");
53 static_assert(std::is_trivially_destructible
<T
>::value
, "");
54 static_assert(std::is_trivially_destructible
<optional
<T
>>::value
, "");
58 static_assert(!std::is_trivially_destructible
<T
>::value
, "");
59 static_assert(!std::is_trivially_destructible
<optional
<T
>>::value
, "");
63 assert(X::dtor_called
== false);
65 assert(X::dtor_called
== true);