//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This test pins down the ABI of std::pair with respect to being "trivially copyable". // // This test doesn't work when the deprecated ABI to turn off pair triviality is enabled. // See libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp instead. // UNSUPPORTED: libcpp-deprecated-abi-disable-pair-trivial-copy-ctor #include #include #include "test_macros.h" struct trivially_copyable { int arr[4]; }; struct trivially_copyable_no_copy_assignment { int arr[4]; trivially_copyable_no_copy_assignment& operator=(const trivially_copyable_no_copy_assignment&) = delete; }; static_assert(std::is_trivially_copyable::value, ""); struct trivially_copyable_no_move_assignment { int arr[4]; trivially_copyable_no_move_assignment& operator=(const trivially_copyable_no_move_assignment&) = delete; }; static_assert(std::is_trivially_copyable::value, ""); struct trivially_copyable_no_construction { int arr[4]; trivially_copyable_no_construction() = default; trivially_copyable_no_construction(const trivially_copyable_no_construction&) = delete; trivially_copyable_no_construction& operator=(const trivially_copyable_no_construction&) = default; }; static_assert(std::is_trivially_copyable::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable, int> >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(!std::is_trivially_copyable >::value, ""); static_assert(std::is_trivially_copy_constructible >::value, ""); static_assert(std::is_trivially_move_constructible >::value, ""); static_assert(!std::is_trivially_copy_assignable >::value, ""); static_assert(!std::is_trivially_move_assignable >::value, ""); static_assert(std::is_trivially_destructible >::value, "");