diff options
Diffstat (limited to 'test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp')
-rw-r--r-- | test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp index 8b5969d51..00c1910a3 100644 --- a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp +++ b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -30,6 +29,7 @@ #include <utility> #include <type_traits> #include <cstdlib> +#include <cstddef> #include <cassert> #include "test_macros.h" @@ -86,7 +86,7 @@ static_assert(!HasNonTrivialABI<Trivial>::value, ""); #endif -int main() +void test_trivial() { { typedef std::pair<int, short> P; @@ -150,3 +150,16 @@ int main() } #endif } + +void test_layout() { + typedef std::pair<std::pair<char, char>, char> PairT; + static_assert(sizeof(PairT) == 3, ""); + static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), ""); + static_assert(offsetof(PairT, first) == 0, ""); +} + +int main(int, char**) { + test_trivial(); + test_layout(); + return 0; +} |