summaryrefslogtreecommitdiff
path: root/test/libcxx/utilities/utility/pairs
diff options
context:
space:
mode:
Diffstat (limited to 'test/libcxx/utilities/utility/pairs')
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp23
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp11
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp23
10 files changed, 84 insertions, 50 deletions
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
index 6a3e613e9..e03fa6d7f 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.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
//
//===----------------------------------------------------------------------===//
@@ -38,7 +37,7 @@ struct ImplicitNothrowT {
int value;
};
-int main() {
+int main(int, char**) {
{ // explicit noexcept test
static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>, int, int>::value, "");
static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>, int, int>::value, "");
@@ -51,4 +50,6 @@ int main() {
static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>, int, int>::value, "");
static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>, int, int>::value, "");
}
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp
index 0e0117e4e..5765700fe 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/assign_tuple_like.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
//
//===----------------------------------------------------------------------===//
@@ -28,7 +27,7 @@
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
-int main()
+int main(int, char**)
{
using C = TestTypes::TestType;
{
@@ -101,4 +100,6 @@ int main()
assert(p.first.value == 42);
assert(p.second.value == -42);
}
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
index 6a2401223..a2fac173e 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.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
//
//===----------------------------------------------------------------------===//
@@ -38,7 +37,7 @@ struct ImplicitNothrowT {
ImplicitNothrowT(ImplicitNothrowT const&) noexcept {}
};
-int main() {
+int main(int, char**) {
{ // explicit noexcept test
static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
ExplicitT const&, ExplicitT const&>::value, "");
@@ -59,4 +58,6 @@ int main() {
static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
ImplicitNothrowT const&, ImplicitNothrowT const&>::value, "");
}
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
index edb3bbf64..16d714ab9 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.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
//
//===----------------------------------------------------------------------===//
@@ -40,7 +39,7 @@ struct ImplicitNothrowT {
int value;
};
-int main() {
+int main(int, char**) {
{ // explicit noexcept test
static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
std::pair<int, int> const&>::value, "");
@@ -61,4 +60,6 @@ int main() {
static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
std::pair<int, int> const&>::value, "");
}
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp
index 2dbf5511d..a7f0f8764 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/default.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
//
//===----------------------------------------------------------------------===//
@@ -27,10 +26,12 @@ struct NonThrowingDefault {
NonThrowingDefault() noexcept { }
};
-int main() {
+int main(int, char**) {
static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, ThrowingDefault>>::value, "");
static_assert(!std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, ThrowingDefault>>::value, "");
static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, NonThrowingDefault>>::value, "");
static_assert( std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, NonThrowingDefault>>::value, "");
+
+ return 0;
}
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;
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
index 8bfeeea5d..5be63dd92 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.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
//
//===----------------------------------------------------------------------===//
@@ -15,11 +14,13 @@
#include <utility>
-int main()
+int main(int, char**)
{
{
typedef std::pair<int, double> P;
std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
// expected-error-re@utility:* {{static_assert failed{{( due to requirement '2U[L]{0,2} < 2')?}} "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"}}
}
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
index 81dad3bc2..e4c953840 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.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
//
//===----------------------------------------------------------------------===//
@@ -24,7 +23,7 @@
#include "archetypes.hpp"
-int main() {
+int main(int, char**) {
using NonThrowingConvert = NonThrowingTypes::ConvertingType;
using ThrowingConvert = NonTrivialTypes::ConvertingType;
static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, ThrowingConvert>,
@@ -35,4 +34,6 @@ int main() {
std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
static_assert( std::is_nothrow_constructible<std::pair<NonThrowingConvert, NonThrowingConvert>,
std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
index 5d8d36262..8cc83f7bd 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.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
//
//===----------------------------------------------------------------------===//
@@ -39,7 +38,7 @@ struct ImplicitNothrowT {
int value;
};
-int main() {
+int main(int, char**) {
{ // explicit noexcept test
static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
std::pair<int, int>&&>::value, "");
@@ -60,4 +59,6 @@ int main() {
static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
std::pair<int, int>&&>::value, "");
}
+
+ return 0;
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
index ec9cc7ec3..1086011c3 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/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
//
//===----------------------------------------------------------------------===//
@@ -25,6 +24,7 @@
#include <utility>
#include <type_traits>
#include <cstdlib>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -81,7 +81,7 @@ static_assert(HasTrivialABI<Trivial>::value, "");
#endif
-int main()
+void test_trivial()
{
{
typedef std::pair<int, short> P;
@@ -145,3 +145,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;
+}