dtor.pass.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // UNSUPPORTED: c++98, c++03
  9. // <tuple>
  10. // template <class... Types> class tuple;
  11. // ~tuple();
  12. // C++17 added:
  13. // The destructor of tuple shall be a trivial destructor
  14. // if (is_trivially_destructible_v<Types> && ...) is true.
  15. #include <tuple>
  16. #include <string>
  17. #include <cassert>
  18. #include <type_traits>
  19. #include "test_macros.h"
  20. int main(int, char**)
  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. return 0;
  33. }