Home | History | Annotate | Download | only in tuple.cnstr
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // <tuple>
     13 
     14 // template <class... Types> class tuple;
     15 
     16 // ~tuple();
     17 
     18 // C++17 added:
     19 //   The destructor of tuple shall be a trivial destructor
     20 //     if (is_trivially_destructible_v<Types> && ...) is true.
     21 
     22 #include <tuple>
     23 #include <string>
     24 #include <cassert>
     25 #include <type_traits>
     26 
     27 int main()
     28 {
     29   static_assert(std::is_trivially_destructible<
     30       std::tuple<> >::value, "");
     31   static_assert(std::is_trivially_destructible<
     32       std::tuple<void*> >::value, "");
     33   static_assert(std::is_trivially_destructible<
     34       std::tuple<int, float> >::value, "");
     35   static_assert(!std::is_trivially_destructible<
     36       std::tuple<std::string> >::value, "");
     37   static_assert(!std::is_trivially_destructible<
     38       std::tuple<int, std::string> >::value, "");
     39 }
     40