xref: /llvm-project/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp (revision 57b08b0944046a6a57ee9b7b479181f548a5b9b4)
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++98, c++03
10 
11 // <tuple>
12 
13 // template <class... Types> class tuple;
14 
15 // ~tuple();
16 
17 // C++17 added:
18 //   The destructor of tuple shall be a trivial destructor
19 //     if (is_trivially_destructible_v<Types> && ...) is true.
20 
21 #include <tuple>
22 #include <string>
23 #include <cassert>
24 #include <type_traits>
25 
26 int main()
27 {
28   static_assert(std::is_trivially_destructible<
29       std::tuple<> >::value, "");
30   static_assert(std::is_trivially_destructible<
31       std::tuple<void*> >::value, "");
32   static_assert(std::is_trivially_destructible<
33       std::tuple<int, float> >::value, "");
34   static_assert(!std::is_trivially_destructible<
35       std::tuple<std::string> >::value, "");
36   static_assert(!std::is_trivially_destructible<
37       std::tuple<int, std::string> >::value, "");
38 }
39