dtor.pass.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. // UNSUPPORTED: c++98, c++03
  10. // <tuple>
  11. // template <class... Types> class tuple;
  12. // ~tuple();
  13. // C++17 added:
  14. // The destructor of tuple shall be a trivial destructor
  15. // if (is_trivially_destructible_v<Types> && ...) is true.
  16. #include <tuple>
  17. #include <string>
  18. #include <cassert>
  19. #include <type_traits>
  20. int main()
  21. {
  22. static_assert(std::is_trivially_destructible<
  23. std::tuple<> >::value, "");
  24. static_assert(std::is_trivially_destructible<
  25. std::tuple<void*> >::value, "");
  26. static_assert(std::is_trivially_destructible<
  27. std::tuple<int, float> >::value, "");
  28. static_assert(!std::is_trivially_destructible<
  29. std::tuple<std::string> >::value, "");
  30. static_assert(!std::is_trivially_destructible<
  31. std::tuple<int, std::string> >::value, "");
  32. }