xref: /llvm-project/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp (revision 7fc6a55688c816f5fc1a5481ae7af25be7500356)
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 #include "test_macros.h"
27 
28 int main(int, char**)
29 {
30   static_assert(std::is_trivially_destructible<
31       std::tuple<> >::value, "");
32   static_assert(std::is_trivially_destructible<
33       std::tuple<void*> >::value, "");
34   static_assert(std::is_trivially_destructible<
35       std::tuple<int, float> >::value, "");
36   static_assert(!std::is_trivially_destructible<
37       std::tuple<std::string> >::value, "");
38   static_assert(!std::is_trivially_destructible<
39       std::tuple<int, std::string> >::value, "");
40 
41   return 0;
42 }
43