diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp @@ -25,18 +25,33 @@ #include "test_macros.h" +struct TrackDtor { + int* count_; + constexpr explicit TrackDtor(int* count) : count_(count) {} + TEST_CONSTEXPR_CXX20 ~TrackDtor() { ++*count_; } +}; + +bool test() { + int count = 0; + { + static_assert(!std::is_trivially_destructible::value); + std::tuple tuple{TrackDtor(&count)}; + assert(count == 1); + } + assert(count == 2); + + return true; +} + int main(int, char**) { - static_assert(std::is_trivially_destructible< - std::tuple<> >::value, ""); - static_assert(std::is_trivially_destructible< - std::tuple >::value, ""); - static_assert(std::is_trivially_destructible< - std::tuple >::value, ""); - static_assert(!std::is_trivially_destructible< - std::tuple >::value, ""); - static_assert(!std::is_trivially_destructible< - std::tuple >::value, ""); + static_assert(std::is_trivially_destructible>::value, ""); + static_assert(std::is_trivially_destructible>::value, ""); + static_assert(std::is_trivially_destructible>::value, ""); + static_assert(!std::is_trivially_destructible>::value, ""); + static_assert(!std::is_trivially_destructible>::value, ""); + + test(); return 0; }