xref: /llvm-project/libcxx/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp (revision 31cbe0f240f660f15602c96b787c58a26f17e179)
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++03
10 
11 // <utility>
12 
13 // template <class T1, class T2> struct pair
14 
15 // ~pair()
16 
17 // C++17 added:
18 //   The destructor of pair shall be a trivial destructor
19 //     if (is_trivially_destructible_v<T1> && is_trivially_destructible_v<T2>) is true.
20 
21 
22 #include <utility>
23 #include <type_traits>
24 #include <string>
25 #include <cassert>
26 
27 #include "test_macros.h"
28 
main(int,char **)29 int main(int, char**)
30 {
31   static_assert((std::is_trivially_destructible<
32       std::pair<int, float> >::value), "");
33   static_assert((!std::is_trivially_destructible<
34       std::pair<int, std::string> >::value), "");
35 
36   return 0;
37 }
38