diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2025-06-13 17:32:45 +0200 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2025-06-13 17:38:47 +0200 |
commit | fe5571edd7aeb2068ed33c24b660e59ca3b4cf59 (patch) | |
tree | 140ea2f1cc3021fef30729d5190662581f637277 | |
parent | 271c5135f04bd939f7205e2bfb6785a2f87b8c72 (diff) | |
download | llvm-users/philnik777/cxx03_tests_remove_non_cxx03_tests.zip llvm-users/philnik777/cxx03_tests_remove_non_cxx03_tests.tar.gz llvm-users/philnik777/cxx03_tests_remove_non_cxx03_tests.tar.bz2 |
[libc++][C++03] Remove tests from libcxx-03 which aren't run in C++03 modeusers/philnik777/cxx03_tests_remove_non_cxx03_tests
605 files changed, 0 insertions, 46811 deletions
diff --git a/libcxx/test/libcxx-03/Wnon_modular_include_in_module.compile.pass.cpp b/libcxx/test/libcxx-03/Wnon_modular_include_in_module.compile.pass.cpp deleted file mode 100644 index aa7a6d9..0000000 --- a/libcxx/test/libcxx-03/Wnon_modular_include_in_module.compile.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: target={{.*}}-apple-{{.*}} -// UNSUPPORTED: c++03 - -// This test ensures that libc++ supports being compiled with modules enabled and with -// -Wnon-modular-include-in-module. This effectively checks that we don't include any -// non-modular header from the library. -// -// Since most underlying platforms are not modularized properly, this test currently only -// works on Apple platforms. - -// ADDITIONAL_COMPILE_FLAGS: -Wnon-modular-include-in-module -Wsystem-headers-in-module=std -fmodules -fcxx-modules - -#include <vector> diff --git a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.verify.cpp b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.verify.cpp deleted file mode 100644 index 057f126..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.verify.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// template <class RandomAccessIterator> -// void -// random_shuffle(RandomAccessIterator first, RandomAccessIterator last); -// -// template <class RandomAccessIterator, class RandomNumberGenerator> -// void -// random_shuffle(RandomAccessIterator first, RandomAccessIterator last, -// RandomNumberGenerator& rand); - -// UNSUPPORTED: c++03, c++11 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE - -#include <algorithm> -#include <cstddef> - -#include "test_macros.h" - -struct gen -{ - std::ptrdiff_t operator()(std::ptrdiff_t n) - { - return n-1; - } -}; - - -void f() { - int v[1] = {1}; - std::random_shuffle(&v[0], &v[1]); // expected-warning {{'random_shuffle<int *>' is deprecated}} - gen r; - std::random_shuffle(&v[0], &v[1], r); // expected-warning {{'random_shuffle<int *, gen &>' is deprecated}} -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp deleted file mode 100644 index 0c5ae84..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_nontrivial.pass.cpp +++ /dev/null @@ -1,331 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// In the modules build, adding another overload of `memmove` doesn't work. -// UNSUPPORTED: clang-modules-build -// GCC complains about "ambiguating" `__builtin_memmove`. -// UNSUPPORTED: gcc - -// <algorithm> - -#include <cassert> -#include <cstddef> - -// These tests check that `std::copy` and `std::move` (including their variations like `copy_n`) don't forward to -// `std::memmove` when doing so would be observable. - -// This template is a better match than the actual `builtin_memmove` (it can match the pointer type exactly, without an -// implicit conversion to `void*`), so it should hijack the call inside `std::copy` and similar algorithms if it's made. -template <class Dst, class Src> -constexpr void* __builtin_memmove(Dst*, Src*, std::size_t) { - assert(false); - return nullptr; -} - -#include <algorithm> -#include <cassert> -#include <cstdint> -#include <iterator> -#include <ranges> -#include <type_traits> - -#include "test_iterators.h" -#include "test_macros.h" - -// S1 and S2 are simple structs that are convertible to each other and have the same bit representation. -struct S1 { - int x; - - constexpr S1() = default; - constexpr S1(int set_x) : x(set_x) {} - - friend constexpr bool operator==(const S1& lhs, const S1& rhs) { return lhs.x == rhs.x; } -}; - -struct S2 { - int x; - - constexpr S2() = default; - constexpr S2(int set_x) : x(set_x) {} - constexpr S2(S1 from) : x(from.x) {} - - friend constexpr bool operator==(const S1& lhs, const S2& rhs) { return lhs.x == rhs.x; } - friend constexpr bool operator==(const S2& lhs, const S2& rhs) { return lhs.x == rhs.x; } -}; - -// U1 and U2 are simple unions that are convertible to each other and have the same bit representation. -union U1 { - int x; - - constexpr U1() = default; - constexpr U1(int set_x) : x(set_x) {} - - friend constexpr bool operator==(const U1& lhs, const U1& rhs) { return lhs.x == rhs.x; } -}; - -union U2 { - int x; - - constexpr U2() = default; - constexpr U2(int set_x) : x(set_x) {} - constexpr U2(U1 from) : x(from.x) {} - - friend constexpr bool operator==(const U1& lhs, const U2& rhs) { return lhs.x == rhs.x; } - friend constexpr bool operator==(const U2& lhs, const U2& rhs) { return lhs.x == rhs.x; } -}; - -struct NonTrivialMoveAssignment { - int i; - - constexpr NonTrivialMoveAssignment() = default; - constexpr NonTrivialMoveAssignment(int set_i) : i(set_i) {} - - constexpr NonTrivialMoveAssignment(NonTrivialMoveAssignment&& rhs) = default; - constexpr NonTrivialMoveAssignment& operator=(NonTrivialMoveAssignment&& rhs) noexcept { - i = rhs.i; - return *this; - } - - constexpr friend bool operator==(const NonTrivialMoveAssignment&, const NonTrivialMoveAssignment&) = default; -}; - -static_assert(!std::is_trivially_move_assignable_v<NonTrivialMoveAssignment>); -static_assert(!std::is_trivially_assignable<NonTrivialMoveAssignment&, NonTrivialMoveAssignment&>::value); - -struct NonTrivialMoveCtr { - int i; - - constexpr NonTrivialMoveCtr() = default; - constexpr NonTrivialMoveCtr(int set_i) : i(set_i) {} - - constexpr NonTrivialMoveCtr(NonTrivialMoveCtr&& rhs) noexcept : i(rhs.i) {} - constexpr NonTrivialMoveCtr& operator=(NonTrivialMoveCtr&& rhs) = default; - - constexpr friend bool operator==(const NonTrivialMoveCtr&, const NonTrivialMoveCtr&) = default; -}; - -static_assert(std::is_trivially_move_assignable_v<NonTrivialMoveCtr>); -static_assert(!std::is_trivially_copyable_v<NonTrivialMoveCtr>); - -struct NonTrivialCopyAssignment { - int i; - - constexpr NonTrivialCopyAssignment() = default; - constexpr NonTrivialCopyAssignment(int set_i) : i(set_i) {} - - constexpr NonTrivialCopyAssignment(const NonTrivialCopyAssignment& rhs) = default; - constexpr NonTrivialCopyAssignment& operator=(const NonTrivialCopyAssignment& rhs) { - i = rhs.i; - return *this; - } - - constexpr friend bool operator==(const NonTrivialCopyAssignment&, const NonTrivialCopyAssignment&) = default; -}; - -static_assert(!std::is_trivially_copy_assignable_v<NonTrivialCopyAssignment>); - -struct NonTrivialCopyCtr { - int i; - - constexpr NonTrivialCopyCtr() = default; - constexpr NonTrivialCopyCtr(int set_i) : i(set_i) {} - - constexpr NonTrivialCopyCtr(const NonTrivialCopyCtr& rhs) : i(rhs.i) {} - constexpr NonTrivialCopyCtr& operator=(const NonTrivialCopyCtr& rhs) = default; - - constexpr friend bool operator==(const NonTrivialCopyCtr&, const NonTrivialCopyCtr&) = default; -}; - -static_assert(std::is_trivially_copy_assignable_v<NonTrivialCopyCtr>); -static_assert(!std::is_trivially_copyable_v<NonTrivialCopyCtr>); - -template <class T> -constexpr T make(int from) { - return T(from); -} - -template <typename PtrT, typename T = std::remove_pointer_t<PtrT>> -static T make_internal_array[5] = {T(), T(), T(), T(), T()}; - -template <class T> -requires std::is_pointer_v<T> -constexpr T make(int i) { - if constexpr (!std::same_as<std::remove_pointer_t<T>, void>) { - return make_internal_array<T> + i; - } else { - return make_internal_array<int> + i; - } -} - -template <class InIter, template <class> class SentWrapper, class OutIter, class Func> -constexpr void test_one(Func func) { - using From = typename std::iterator_traits<InIter>::value_type; - using To = typename std::iterator_traits<OutIter>::value_type; - - { - const std::size_t N = 5; - - From input[N] = {make<From>(0), make<From>(1), make<From>(2), make<From>(3), make<From>(4)}; - To output[N]; - - auto in = InIter(input); - auto in_end = InIter(input + N); - auto sent = SentWrapper<decltype(in_end)>(in_end); - auto out = OutIter(output); - - func(in, sent, out, N); - if constexpr (!std::same_as<To, bool>) { - assert(std::equal(input, input + N, output)); - } else { - bool expected[N] = {false, true, true, true, true}; - assert(std::equal(output, output + N, expected)); - } - } - - { - const std::size_t N = 0; - - From input[1] = {make<From>(1)}; - To output[1] = {make<To>(2)}; - - auto in = InIter(input); - auto in_end = InIter(input + N); - auto sent = SentWrapper<decltype(in_end)>(in_end); - auto out = OutIter(output); - - func(in, sent, out, N); - assert(output[0] == make<To>(2)); - } -} - -template <class InIter, template <class> class SentWrapper, class OutIter> -constexpr void test_copy() { - // Classic. - if constexpr (std::same_as<InIter, SentWrapper<InIter>>) { - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::copy(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::copy_backward(first, last, out + n); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto, auto out, std::size_t n) { - std::copy_n(first, n, out); - }); - } - - // Ranges. - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::ranges::copy(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::ranges::copy_backward(first, last, out + n); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto, auto out, std::size_t n) { - std::ranges::copy_n(first, n, out); - }); -} - -template <class InIter, template <class> class SentWrapper, class OutIter> -constexpr void test_move() { - if constexpr (std::same_as<InIter, SentWrapper<InIter>>) { - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::move(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::move_backward(first, last, out + n); - }); - } - - // Ranges. - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::ranges::move(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::ranges::move_backward(first, last, out + n); - }); -} - -template <class From, class To = From> -constexpr void test_copy_with_type() { - using FromIter = contiguous_iterator<From*>; - using ToIter = contiguous_iterator<To*>; - - test_copy<FromIter, std::type_identity_t, ToIter>(); - test_copy<FromIter, sized_sentinel, ToIter>(); - test_copy<FromIter, std::type_identity_t, To*>(); - test_copy<From*, std::type_identity_t, To*>(); - test_copy<From*, std::type_identity_t, ToIter>(); -} - -template <class From, class To = From> -constexpr void test_move_with_type() { - using FromIter = contiguous_iterator<From*>; - using ToIter = contiguous_iterator<To*>; - - test_move<FromIter, std::type_identity_t, ToIter>(); - test_move<FromIter, sized_sentinel, ToIter>(); - test_move<FromIter, std::type_identity_t, To*>(); - test_move<From*, std::type_identity_t, To*>(); - test_move<From*, std::type_identity_t, ToIter>(); -} - -template <class From, class To> -constexpr void test_copy_and_move() { - test_copy_with_type<From, To>(); - test_move_with_type<From, To>(); -} - -template <class From, class To> -constexpr void test_both_directions() { - test_copy_and_move<From, To>(); - if (!std::same_as<From, To>) { - test_copy_and_move<To, From>(); - } -} - -constexpr bool test() { - test_copy_with_type<NonTrivialCopyAssignment>(); - test_move_with_type<NonTrivialMoveAssignment>(); - - // Copying from a smaller type into a larger type and vice versa. - test_both_directions<char, int>(); - test_both_directions<std::int32_t, std::int64_t>(); - - // Copying between types with different representations. - test_both_directions<int, float>(); - // Copying from `bool` to `char` will invoke the optimization, so only check one direction. - test_copy_and_move<char, bool>(); - - // Copying between different structs with the same representation (there is no way to guarantee the representation is - // the same). - test_copy_and_move<S1, S2>(); - // Copying between different unions with the same representation. - test_copy_and_move<U1, U2>(); - - // Copying from a regular pointer to a void pointer (these are not considered trivially copyable). - test_copy_and_move<int*, void*>(); - // Copying from a non-const pointer to a const pointer (these are not considered trivially copyable). - test_copy_and_move<int*, const int*>(); - - // `memmove` does not support volatile pointers. - // (See also https://github.com/llvm/llvm-project/issues/28901). - if (!std::is_constant_evaluated()) { - test_both_directions<volatile int, int>(); - test_both_directions<volatile int, volatile int>(); - } - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp deleted file mode 100644 index ff10c79..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_trivial.pass.cpp +++ /dev/null @@ -1,334 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// In the modules build, adding another overload of `memmove` doesn't work. -// UNSUPPORTED: clang-modules-build -// GCC complains about "ambiguating" `__builtin_memmove`. -// UNSUPPORTED: gcc - -// <algorithm> - -// These tests check that `std::copy` and `std::move` (including their variations like `copy_n`) forward to -// `memmove` when possible. - -#include <cstddef> - -struct Foo { - int i = 0; - - Foo() = default; - Foo(int set_i) : i(set_i) {} - - friend bool operator==(const Foo&, const Foo&) = default; -}; - -static bool memmove_called = false; - -// This template is a better match than the actual `builtin_memmove` (it can match the pointer type exactly, without an -// implicit conversion to `void*`), so it should hijack the call inside `std::copy` and similar algorithms if it's made. -template <class Dst, class Src> -constexpr void* __builtin_memmove(Dst* dst, Src* src, std::size_t count) { - memmove_called = true; - return __builtin_memmove(static_cast<void*>(dst), static_cast<const void*>(src), count); -} - -#include <algorithm> -#include <cassert> -#include <cstdint> -#include <iterator> -#include <limits> -#include <ranges> -#include <type_traits> - -#include "test_iterators.h" - -static_assert(std::is_trivially_copyable_v<Foo>); - -// To test pointers to functions. -void Func() {} -using FuncPtr = decltype(&Func); - -// To test pointers to members. -struct S { - int mem_obj = 0; - void MemFunc() {} -}; -using MemObjPtr = decltype(&S::mem_obj); -using MemFuncPtr = decltype(&S::MemFunc); - -// To test bitfields. -struct BitfieldS { - unsigned char b1 : 3; - unsigned char : 2; - unsigned char b2 : 5; - friend bool operator==(const BitfieldS&, const BitfieldS&) = default; -}; - -// To test non-default alignment. -struct AlignedS { - alignas(64) int x; - alignas(8) int y; - friend bool operator==(const AlignedS&, const AlignedS&) = default; -}; - -template <class T> -T make(int from) { - return T(from); -} - -template <class T> -requires (std::is_pointer_v<T> && !std::is_function_v<std::remove_pointer_t<T>>) -T make(int i) { - static std::remove_pointer_t<T> arr[8]; - return arr + i; -} - -template <class T> -requires std::same_as<T, FuncPtr> -FuncPtr make(int) { - return &Func; -} - -template <class T> -requires std::same_as<T, MemObjPtr> -MemObjPtr make(int) { - return &S::mem_obj; -} - -template <class T> -requires std::same_as<T, MemFuncPtr> -MemFuncPtr make(int) { - return &S::MemFunc; -} - -template <class T> -requires std::same_as<T, BitfieldS> -BitfieldS make(int x) { - BitfieldS result = {}; - result.b1 = x; - result.b2 = x; - return result; -} - -template <class T> -requires std::same_as<T, AlignedS> -AlignedS make(int x) { - AlignedS result; - result.x = x; - result.y = x; - return result; -} - -template <class InIter, template <class> class SentWrapper, class OutIter, class Func> -void test_one(Func func) { - using From = std::iter_value_t<InIter>; - using To = std::iter_value_t<OutIter>; - - // Normal case. - { - const std::size_t N = 4; - - From input[N] = {make<From>(1), make<From>(2), make<From>(3), make<From>(4)}; - To output[N]; - - auto in = InIter(input); - auto in_end = InIter(input + N); - auto sent = SentWrapper<decltype(in_end)>(in_end); - auto out = OutIter(output); - - assert(!memmove_called); - func(in, sent, out, N); - assert(memmove_called); - memmove_called = false; - - assert(std::equal(input, input + N, output, [](const From& lhs, const To& rhs) { - // Prevents warnings/errors due to mismatched signed-ness. - if constexpr (std::convertible_to<From, To>) { - return static_cast<To>(lhs) == rhs; - } else if constexpr (std::convertible_to<To, From>) { - return lhs == static_cast<From>(rhs); - } - })); - } -} - -template <class InIter, template <class> class SentWrapper, class OutIter> -void test_copy_and_move() { - // Classic. - if constexpr (std::same_as<InIter, SentWrapper<InIter>>) { - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::copy(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::copy_backward(first, last, out + n); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto, auto out, std::size_t n) { - std::copy_n(first, n, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::move(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::move_backward(first, last, out + n); - }); - } - - // Ranges. - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::ranges::copy(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::ranges::copy_backward(first, last, out + n); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto, auto out, std::size_t n) { - std::ranges::copy_n(first, n, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t) { - std::ranges::move(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter>([](auto first, auto last, auto out, std::size_t n) { - std::ranges::move_backward(first, last, out + n); - }); -} - -template <class From, class To, template <class> class SentWrapper, bool BothDirections = !std::same_as<From, To>> -void test_all_permutations_from_to_sent() { - test_copy_and_move<From*, SentWrapper, To*>(); - test_copy_and_move<contiguous_iterator<From*>, SentWrapper, To*>(); - test_copy_and_move<From*, SentWrapper, contiguous_iterator<To*>>(); - test_copy_and_move<contiguous_iterator<From*>, SentWrapper, contiguous_iterator<To*>>(); - - if (BothDirections) { - test_copy_and_move<To*, SentWrapper, From*>(); - test_copy_and_move<contiguous_iterator<To*>, SentWrapper, From*>(); - test_copy_and_move<To*, SentWrapper, contiguous_iterator<From*>>(); - test_copy_and_move<contiguous_iterator<To*>, SentWrapper, contiguous_iterator<From*>>(); - } -} - -void test_different_signedness() { - auto check = [](auto alg) { - // Signed -> unsigned. - { - constexpr int N = 3; - constexpr auto min_value = std::numeric_limits<int>::min(); - - int in[N] = {-1, min_value / 2, min_value}; - unsigned int out[N]; - unsigned int expected[N] = { - static_cast<unsigned int>(in[0]), - static_cast<unsigned int>(in[1]), - static_cast<unsigned int>(in[2]), - }; - - assert(!memmove_called); - alg(in, in + N, out, N); - assert(memmove_called); - memmove_called = false; - - assert(std::equal(out, out + N, expected)); - } - - // Unsigned -> signed. - { - constexpr int N = 3; - constexpr auto max_signed = std::numeric_limits<int>::max(); - constexpr auto max_unsigned = std::numeric_limits<unsigned int>::max(); - - unsigned int in[N] = {static_cast<unsigned int>(max_signed) + 1, max_unsigned / 2, max_unsigned}; - int out[N]; - int expected[N] = { - static_cast<int>(in[0]), - static_cast<int>(in[1]), - static_cast<int>(in[2]), - }; - - assert(!memmove_called); - alg(in, in + N, out, N); - assert(memmove_called); - memmove_called = false; - - assert(std::equal(out, out + N, expected)); - } - }; - - check([](auto first, auto last, auto out, std::size_t) { - std::copy(first, last, out); - }); - check([](auto first, auto last, auto out, std::size_t n) { - std::copy_backward(first, last, out + n); - }); - check([](auto first, auto, auto out, std::size_t n) { - std::copy_n(first, n, out); - }); - check([](auto first, auto last, auto out, std::size_t) { - std::move(first, last, out); - }); - check([](auto first, auto last, auto out, std::size_t n) { - std::move_backward(first, last, out + n); - }); - - // Ranges. - check([](auto first, auto last, auto out, std::size_t) { - std::ranges::copy(first, last, out); - }); - check([](auto first, auto last, auto out, std::size_t n) { - std::ranges::copy_backward(first, last, out + n); - }); - check([](auto first, auto, auto out, std::size_t n) { - std::ranges::copy_n(first, n, out); - }); - check([](auto first, auto last, auto out, std::size_t) { - std::ranges::move(first, last, out); - }); - check([](auto first, auto last, auto out, std::size_t n) { - std::ranges::move_backward(first, last, out + n); - }); -} - -void test() { - // Built-in. - test_all_permutations_from_to_sent<int, int, std::type_identity_t>(); - // User-defined. - test_all_permutations_from_to_sent<Foo, Foo, std::type_identity_t>(); - - // Conversions. - test_all_permutations_from_to_sent<char32_t, std::int32_t, sized_sentinel>(); - test_all_permutations_from_to_sent<std::int32_t, std::uint32_t, sized_sentinel>(); - // Conversion from `bool` to `char` invokes the optimization (the set of values for `char` is a superset of the set of - // values for `bool`), but the other way round cannot. - test_all_permutations_from_to_sent<bool, char, sized_sentinel, /*BothDirections=*/false>(); - - // Copying between regular pointers. - test_copy_and_move<int**, std::type_identity_t, int**>(); - - // Copying between pointers to functions. - test_copy_and_move<FuncPtr*, std::type_identity_t, FuncPtr*>(); - - // Copying between pointers to members. - test_copy_and_move<MemObjPtr*, std::type_identity_t, MemObjPtr*>(); - test_copy_and_move<MemFuncPtr*, std::type_identity_t, MemFuncPtr*>(); - - // Copying structs with bitfields. - test_copy_and_move<BitfieldS*, std::type_identity_t, BitfieldS*>(); - - // Copying objects with non-default alignment. - test_copy_and_move<AlignedS*, std::type_identity_t, AlignedS*>(); - - // Copying integers with different signedness produces the same results as built-in assignment. - test_different_signedness(); -} - -int main(int, char**) { - test(); - // The test relies on a global variable, so it cannot be made `constexpr`; the `memmove` optimization is not used in - // `constexpr` mode anyway. - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp deleted file mode 100644 index 2a85e7b..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <algorithm> - -// These tests checks that `std::copy` and `std::move` (including their variations like `copy_n`) can unwrap multiple -// layers of reverse iterators. - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <cstdint> -#include <iterator> -#include <type_traits> - -#include "test_iterators.h" - -template <std::size_t N, class Iter> -requires (N == 0) -constexpr auto wrap_n_times(Iter i) { - return i; -} - -template <std::size_t N, class Iter> -requires (N != 0) -constexpr auto wrap_n_times(Iter i) { - return std::make_reverse_iterator(wrap_n_times<N - 1>(i)); -} - -static_assert(std::is_same_v<decltype(wrap_n_times<2>(std::declval<int*>())), - std::reverse_iterator<std::reverse_iterator<int*>>>); - -template <class InIter, template <class> class SentWrapper, class OutIter, std::size_t W1, size_t W2, class Func> -constexpr void test_one(Func func) { - using From = std::iter_value_t<InIter>; - using To = std::iter_value_t<OutIter>; - - const std::size_t N = 4; - - From input[N] = {{1}, {2}, {3}, {4}}; - To output[N]; - - auto in = wrap_n_times<W1>(InIter(input)); - auto in_end = wrap_n_times<W1>(InIter(input + N)); - auto sent = SentWrapper<decltype(in_end)>(in_end); - auto out = wrap_n_times<W2>(OutIter(output)); - - func(in, sent, out, N); - - assert(std::equal(input, input + N, output, [](const From& lhs, const To& rhs) { - // Prevents warnings/errors due to mismatched signed-ness. - return lhs == static_cast<From>(rhs); - })); -} - -template <class InIter, template <class> class SentWrapper, class OutIter, std::size_t W1, size_t W2> -constexpr void test_copy_and_move() { - // Classic. - if constexpr (std::same_as<InIter, SentWrapper<InIter>>) { - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t) { - std::copy(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t n) { - std::copy_backward(first, last, out + n); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto, auto out, std::size_t n) { - std::copy_n(first, n, out); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t) { - std::move(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t n) { - std::move_backward(first, last, out + n); - }); - } - - // Ranges. - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t) { - std::ranges::copy(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t n) { - std::ranges::copy_backward(first, last, out + n); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto, auto out, std::size_t n) { - std::ranges::copy_n(first, n, out); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t) { - std::ranges::move(first, last, out); - }); - test_one<InIter, SentWrapper, OutIter, W1, W2>([](auto first, auto last, auto out, std::size_t n) { - std::ranges::move_backward(first, last, out + n); - }); -} - -template <std::size_t W1, size_t W2, class From, class To, template <class> class SentWrapper> -constexpr void test_all_permutations_with_counts_from_to_sent() { - test_copy_and_move<From*, SentWrapper, To*, W1, W2>(); - test_copy_and_move<contiguous_iterator<From*>, SentWrapper, To*, W1, W2>(); - test_copy_and_move<From*, SentWrapper, contiguous_iterator<To*>, W1, W2>(); - test_copy_and_move<contiguous_iterator<From*>, SentWrapper, contiguous_iterator<To*>, W1, W2>(); - - if (!std::same_as<From, To>) { - test_copy_and_move<To*, SentWrapper, From*, W1, W2>(); - test_copy_and_move<contiguous_iterator<To*>, SentWrapper, From*, W1, W2>(); - test_copy_and_move<To*, SentWrapper, contiguous_iterator<From*>, W1, W2>(); - test_copy_and_move<contiguous_iterator<To*>, SentWrapper, contiguous_iterator<From*>, W1, W2>(); - } -} - -template <std::size_t W1, size_t W2> -constexpr void test_all_permutations_with_counts() { - test_all_permutations_with_counts_from_to_sent<W1, W2, int, int, std::type_identity_t>(); - test_all_permutations_with_counts_from_to_sent<W1, W2, int, int, sized_sentinel>(); - test_all_permutations_with_counts_from_to_sent<W1, W2, std::int32_t, std::uint32_t, std::type_identity_t>(); - test_all_permutations_with_counts_from_to_sent<W1, W2, std::int32_t, std::uint32_t, sized_sentinel>(); -} - -constexpr bool test() { - test_all_permutations_with_counts<0, 0>(); - test_all_permutations_with_counts<0, 2>(); - test_all_permutations_with_counts<2, 0>(); - test_all_permutations_with_counts<2, 2>(); - test_all_permutations_with_counts<2, 4>(); - test_all_permutations_with_counts<4, 4>(); - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp deleted file mode 100644 index cc48a81..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -// <algorithm> - -// template<class Iter> -// void make_heap(Iter first, Iter last); - -#include <algorithm> -#include <cassert> -#include <random> -#include <vector> - -#include "test_macros.h" - -struct Stats { - int compared = 0; - int copied = 0; - int moved = 0; -} stats; - -struct MyInt { - int value; - explicit MyInt(int xval) : value(xval) {} - MyInt(const MyInt& other) : value(other.value) { ++stats.copied; } - MyInt(MyInt&& other) : value(other.value) { ++stats.moved; } - MyInt& operator=(const MyInt& other) { - value = other.value; - ++stats.copied; - return *this; - } - MyInt& operator=(MyInt&& other) { - value = other.value; - ++stats.moved; - return *this; - } - friend bool operator<(const MyInt& a, const MyInt& b) { - ++stats.compared; - return a.value < b.value; - } -}; - -int main(int, char**) -{ - const int N = 100'000; - std::vector<MyInt> v; - v.reserve(N); - std::mt19937 g; - for (int i = 0; i < N; ++i) - v.emplace_back(g()); - - // The exact stats of our current implementation are recorded here. - // If something changes to make them go a bit up or down, that's probably fine, - // and we can just update this test. - // But if they suddenly leap upward, that's a bad thing. - - stats = {}; - std::make_heap(v.begin(), v.end()); - assert(stats.copied == 0); - assert(stats.moved == 153'486); -#if _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_DEBUG - assert(stats.compared == 188'285); -#endif - - assert(std::is_heap(v.begin(), v.end())); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.min.max.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.min.max.pass.cpp deleted file mode 100644 index 7e765d7..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.min.max.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <algorithm> -#include <array> - -#include "check_assertion.h" - -int main(int, char**) { - std::initializer_list<int> init_list{}; - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::minmax(init_list), - "initializer_list has to contain at least one element"); - - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::minmax(std::array<int, 0>{}), - "range has to contain at least one element"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/assert.sort.invalid_comparator.oob.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/assert.sort.invalid_comparator.oob.pass.cpp deleted file mode 100644 index 6ddee1b..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/assert.sort.invalid_comparator.oob.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// In the debug mode, the comparator validations will notice that it doesn't satisfy strict weak ordering before the -// algorithm actually runs and goes out of bounds, so the test will terminate before the tested assertions are -// triggered. -// UNSUPPORTED: libcpp-hardening-mode=none, libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <memory> -#include <set> -#include <string> -#include <vector> - -#include "bad_comparator_values.h" -#include "check_assertion.h" -#include "invalid_comparator_utilities.h" - -void check_oob_sort_read() { - SortingFixture fixture(SORT_DATA); - - // Check the classic sorting algorithms - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::sort(copy.begin(), copy.end(), fixture.checked_predicate()), - "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); - } - - // Check the Ranges sorting algorithms - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort(copy, fixture.checked_predicate()), - "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); - } -} - -void check_oob_nth_element_read() { - SortingFixture fixture(NTH_ELEMENT_DATA); - - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::nth_element(copy.begin(), copy.begin(), copy.end(), fixture.checked_predicate()), - "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); - } - - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::nth_element(copy, copy.begin(), fixture.checked_predicate()), - "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); - } -} - -int main(int, char**) { - check_oob_sort_read(); - check_oob_nth_element_read(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/assert.sort.invalid_comparator.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/assert.sort.invalid_comparator.pass.cpp deleted file mode 100644 index 9267161..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/assert.sort.invalid_comparator.pass.cpp +++ /dev/null @@ -1,195 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// This test uses a specific combination of an invalid comparator and sequence of values to -// ensure that our sorting functions do not go out-of-bounds and satisfy strict weak ordering in that case. -// Instead, we should fail loud with an assertion. The specific issue we're looking for here is when the comparator -// does not satisfy the strict weak ordering: -// -// Irreflexivity: comp(a, a) is false -// Antisymmetry: comp(a, b) implies that !comp(b, a) -// Transitivity: comp(a, b), comp(b, c) imply comp(a, c) -// Transitivity of equivalence: !comp(a, b), !comp(b, a), !comp(b, c), !comp(c, b) imply !comp(a, c), !comp(c, a) -// -// If this is not satisfied, we have seen issues in the past where the std::sort implementation -// would proceed to do OOB reads. (rdar://106897934). -// Other algorithms like std::stable_sort, std::sort_heap do not go out of bounds but can produce -// incorrect results, we also want to assert on that. -// Sometimes std::sort does not go out of bounds as well, for example, right now if transitivity -// of equivalence is not met, std::sort can only produce incorrect result but would not fail. - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <limits> -#include <map> -#include <memory> -#include <ranges> -#include <random> -#include <set> -#include <string> -#include <vector> - -#include "bad_comparator_values.h" -#include "check_assertion.h" -#include "invalid_comparator_utilities.h" - -void check_oob_sort_read() { - SortingFixture fixture(SORT_DATA); - - // Check the classic sorting algorithms - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::sort(copy.begin(), copy.end(), fixture.checked_predicate()), - "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::stable_sort(copy.begin(), copy.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::make_heap(copy.begin(), copy.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE(std::sort_heap(copy.begin(), copy.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::partial_sort(copy.begin(), copy.end(), copy.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - std::vector<std::size_t*> results(copy.size(), nullptr); - TEST_LIBCPP_ASSERT_FAILURE( - std::partial_sort_copy(copy.begin(), copy.end(), results.begin(), results.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - - // Check the Ranges sorting algorithms - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort(copy, fixture.checked_predicate()), - "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::stable_sort(copy, fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::make_heap(copy, fixture.checked_predicate()), "Comparator does not induce a strict weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort_heap(copy, fixture.checked_predicate()), "Comparator does not induce a strict weak ordering"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::partial_sort(copy, copy.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - { - std::vector<std::size_t*> copy = fixture.create_elements(); - std::vector<std::size_t*> results(copy.size(), nullptr); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::partial_sort_copy(copy, results, fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } -} - -void check_oob_nth_element_read() { - SortingFixture fixture(NTH_ELEMENT_DATA); - - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::nth_element(copy.begin(), copy.begin(), copy.end(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } - - { - std::vector<std::size_t*> copy = fixture.create_elements(); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::nth_element(copy, copy.begin(), fixture.checked_predicate()), - "Comparator does not induce a strict weak ordering"); - } -} - -struct FloatContainer { - float value; - bool operator<(const FloatContainer& other) const { return value < other.value; } -}; - -// Nans in floats do not satisfy strict weak ordering by breaking transitivity of equivalence. -std::vector<FloatContainer> generate_float_data() { - std::vector<FloatContainer> floats(50); - for (int i = 0; i < 50; ++i) { - floats[i].value = static_cast<float>(i); - } - floats.push_back(FloatContainer{std::numeric_limits<float>::quiet_NaN()}); - std::shuffle(floats.begin(), floats.end(), std::default_random_engine()); - return floats; -} - -void check_nan_floats() { - auto floats = generate_float_data(); - TEST_LIBCPP_ASSERT_FAILURE( - std::sort(floats.begin(), floats.end()), "Your comparator is not a valid strict-weak ordering"); - floats = generate_float_data(); - TEST_LIBCPP_ASSERT_FAILURE( - std::stable_sort(floats.begin(), floats.end()), "Your comparator is not a valid strict-weak ordering"); - floats = generate_float_data(); - std::make_heap(floats.begin(), floats.end()); - TEST_LIBCPP_ASSERT_FAILURE( - std::sort_heap(floats.begin(), floats.end()), "Your comparator is not a valid strict-weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort(generate_float_data(), std::less()), "Your comparator is not a valid strict-weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::stable_sort(generate_float_data(), std::less()), - "Your comparator is not a valid strict-weak ordering"); - floats = generate_float_data(); - std::ranges::make_heap(floats, std::less()); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort_heap(floats, std::less()), "Your comparator is not a valid strict-weak ordering"); -} - -void check_irreflexive() { - std::vector<int> v(1); - TEST_LIBCPP_ASSERT_FAILURE( - std::sort(v.begin(), v.end(), std::greater_equal<int>()), "Your comparator is not a valid strict-weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE(std::stable_sort(v.begin(), v.end(), std::greater_equal<int>()), - "Your comparator is not a valid strict-weak ordering"); - std::make_heap(v.begin(), v.end(), std::greater_equal<int>()); - TEST_LIBCPP_ASSERT_FAILURE(std::sort_heap(v.begin(), v.end(), std::greater_equal<int>()), - "Comparator does not induce a strict weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort(v, std::greater_equal<int>()), "Your comparator is not a valid strict-weak ordering"); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::stable_sort(v, std::greater_equal<int>()), "Your comparator is not a valid strict-weak ordering"); - std::ranges::make_heap(v, std::greater_equal<int>()); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::sort_heap(v, std::greater_equal<int>()), "Comparator does not induce a strict weak ordering"); -} - -int main(int, char**) { - check_oob_sort_read(); - - check_oob_nth_element_read(); - - check_nan_floats(); - - check_irreflexive(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/bad_comparator_values.h b/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/bad_comparator_values.h deleted file mode 100644 index 1a5910c..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/bad_comparator_values.h +++ /dev/null @@ -1,3565 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_ALGORITHMS_ALG_SORTING_ASSERT_SORT_INVALID_COMPARATOR_BAD_COMPARATOR_VALUES_H -#define TEST_LIBCXX_ALGORITHMS_ALG_SORTING_ASSERT_SORT_INVALID_COMPARATOR_BAD_COMPARATOR_VALUES_H - -#include <string_view> - -inline constexpr std::string_view NTH_ELEMENT_DATA = R"( -0 0 0 -0 1 0 -0 2 0 -0 3 0 -0 4 1 -0 5 0 -0 6 0 -0 7 0 -1 0 0 -1 1 0 -1 2 0 -1 3 1 -1 4 1 -1 5 1 -1 6 1 -1 7 1 -2 0 1 -2 1 1 -2 2 1 -2 3 1 -2 4 1 -2 5 1 -2 6 1 -2 7 1 -3 0 1 -3 1 1 -3 2 1 -3 3 1 -3 4 1 -3 5 1 -3 6 1 -3 7 1 -4 0 1 -4 1 1 -4 2 1 -4 3 1 -4 4 1 -4 5 1 -4 6 1 -4 7 1 -5 0 1 -5 1 1 -5 2 1 -5 3 1 -5 4 1 -5 5 1 -5 6 1 -5 7 1 -6 0 1 -6 1 1 -6 2 1 -6 3 1 -6 4 1 -6 5 1 -6 6 1 -6 7 1 -7 0 1 -7 1 1 -7 2 1 -7 3 1 -7 4 1 -7 5 1 -7 6 1 -7 7 1 -)"; - -inline constexpr std::string_view SORT_DATA = R"( -0 0 0 -0 1 1 -0 2 1 -0 3 1 -0 4 1 -0 5 1 -0 6 1 -0 7 1 -0 8 1 -0 9 1 -0 10 1 -0 11 1 -0 12 1 -0 13 1 -0 14 1 -0 15 1 -0 16 1 -0 17 1 -0 18 1 -0 19 1 -0 20 1 -0 21 1 -0 22 1 -0 23 1 -0 24 1 -0 25 1 -0 26 1 -0 27 1 -0 28 1 -0 29 1 -0 30 1 -0 31 1 -0 32 1 -0 33 1 -0 34 1 -0 35 1 -0 36 1 -0 37 1 -0 38 1 -0 39 1 -0 40 1 -0 41 1 -0 42 1 -0 43 1 -0 44 1 -0 45 1 -0 46 1 -0 47 1 -0 48 1 -0 49 1 -0 50 1 -0 51 1 -0 52 1 -0 53 1 -0 54 1 -0 55 1 -0 56 1 -0 57 1 -0 58 1 -1 0 0 -1 1 0 -1 2 1 -1 3 1 -1 4 1 -1 5 1 -1 6 1 -1 7 1 -1 8 1 -1 9 1 -1 10 1 -1 11 1 -1 12 1 -1 13 1 -1 14 1 -1 15 1 -1 16 1 -1 17 1 -1 18 1 -1 19 1 -1 20 1 -1 21 1 -1 22 1 -1 23 1 -1 24 1 -1 25 1 -1 26 1 -1 27 1 -1 28 1 -1 29 1 -1 30 1 -1 31 1 -1 32 1 -1 33 1 -1 34 1 -1 35 1 -1 36 1 -1 37 1 -1 38 1 -1 39 1 -1 40 1 -1 41 1 -1 42 1 -1 43 1 -1 44 1 -1 45 1 -1 46 1 -1 47 1 -1 48 1 -1 49 1 -1 50 1 -1 51 1 -1 52 1 -1 53 1 -1 54 1 -1 55 1 -1 56 1 -1 57 1 -1 58 1 -2 0 0 -2 1 0 -2 2 0 -2 3 1 -2 4 1 -2 5 1 -2 6 1 -2 7 1 -2 8 1 -2 9 1 -2 10 1 -2 11 1 -2 12 1 -2 13 1 -2 14 1 -2 15 1 -2 16 1 -2 17 1 -2 18 1 -2 19 1 -2 20 1 -2 21 1 -2 22 1 -2 23 1 -2 24 1 -2 25 1 -2 26 1 -2 27 1 -2 28 1 -2 29 1 -2 30 1 -2 31 1 -2 32 1 -2 33 1 -2 34 1 -2 35 1 -2 36 1 -2 37 1 -2 38 1 -2 39 1 -2 40 1 -2 41 1 -2 42 1 -2 43 1 -2 44 1 -2 45 1 -2 46 1 -2 47 1 -2 48 1 -2 49 1 -2 50 1 -2 51 1 -2 52 1 -2 53 1 -2 54 1 -2 55 1 -2 56 1 -2 57 1 -2 58 1 -3 0 0 -3 1 0 -3 2 0 -3 3 0 -3 4 1 -3 5 1 -3 6 1 -3 7 1 -3 8 1 -3 9 1 -3 10 1 -3 11 1 -3 12 1 -3 13 1 -3 14 1 -3 15 1 -3 16 1 -3 17 1 -3 18 1 -3 19 1 -3 20 1 -3 21 1 -3 22 1 -3 23 1 -3 24 1 -3 25 1 -3 26 1 -3 27 1 -3 28 1 -3 29 1 -3 30 1 -3 31 1 -3 32 1 -3 33 1 -3 34 1 -3 35 1 -3 36 1 -3 37 1 -3 38 1 -3 39 1 -3 40 1 -3 41 1 -3 42 1 -3 43 1 -3 44 1 -3 45 1 -3 46 1 -3 47 1 -3 48 1 -3 49 1 -3 50 1 -3 51 1 -3 52 1 -3 53 1 -3 54 1 -3 55 1 -3 56 1 -3 57 1 -3 58 1 -4 0 0 -4 1 0 -4 2 0 -4 3 0 -4 4 0 -4 5 1 -4 6 1 -4 7 1 -4 8 1 -4 9 1 -4 10 1 -4 11 1 -4 12 1 -4 13 1 -4 14 1 -4 15 1 -4 16 1 -4 17 1 -4 18 1 -4 19 1 -4 20 1 -4 21 1 -4 22 1 -4 23 1 -4 24 1 -4 25 1 -4 26 1 -4 27 1 -4 28 1 -4 29 1 -4 30 1 -4 31 1 -4 32 1 -4 33 1 -4 34 1 -4 35 1 -4 36 1 -4 37 1 -4 38 1 -4 39 1 -4 40 1 -4 41 1 -4 42 1 -4 43 1 -4 44 1 -4 45 1 -4 46 1 -4 47 1 -4 48 1 -4 49 1 -4 50 1 -4 51 1 -4 52 1 -4 53 1 -4 54 1 -4 55 1 -4 56 1 -4 57 1 -4 58 1 -5 0 0 -5 1 0 -5 2 0 -5 3 0 -5 4 0 -5 5 0 -5 6 1 -5 7 1 -5 8 1 -5 9 1 -5 10 1 -5 11 1 -5 12 1 -5 13 1 -5 14 1 -5 15 1 -5 16 1 -5 17 1 -5 18 1 -5 19 1 -5 20 1 -5 21 1 -5 22 1 -5 23 1 -5 24 1 -5 25 1 -5 26 1 -5 27 1 -5 28 1 -5 29 1 -5 30 1 -5 31 1 -5 32 1 -5 33 1 -5 34 1 -5 35 1 -5 36 1 -5 37 1 -5 38 1 -5 39 1 -5 40 1 -5 41 1 -5 42 1 -5 43 1 -5 44 1 -5 45 1 -5 46 1 -5 47 1 -5 48 1 -5 49 1 -5 50 1 -5 51 1 -5 52 1 -5 53 1 -5 54 1 -5 55 1 -5 56 1 -5 57 1 -5 58 1 -6 0 0 -6 1 0 -6 2 0 -6 3 0 -6 4 0 -6 5 0 -6 6 0 -6 7 1 -6 8 1 -6 9 1 -6 10 1 -6 11 1 -6 12 1 -6 13 1 -6 14 1 -6 15 1 -6 16 1 -6 17 1 -6 18 1 -6 19 1 -6 20 1 -6 21 1 -6 22 1 -6 23 1 -6 24 1 -6 25 1 -6 26 1 -6 27 1 -6 28 1 -6 29 1 -6 30 1 -6 31 1 -6 32 1 -6 33 1 -6 34 1 -6 35 1 -6 36 1 -6 37 1 -6 38 1 -6 39 1 -6 40 1 -6 41 1 -6 42 1 -6 43 1 -6 44 1 -6 45 1 -6 46 1 -6 47 1 -6 48 1 -6 49 1 -6 50 1 -6 51 1 -6 52 1 -6 53 1 -6 54 1 -6 55 1 -6 56 1 -6 57 1 -6 58 1 -7 0 0 -7 1 0 -7 2 0 -7 3 0 -7 4 0 -7 5 0 -7 6 0 -7 7 0 -7 8 1 -7 9 1 -7 10 1 -7 11 1 -7 12 1 -7 13 1 -7 14 1 -7 15 1 -7 16 1 -7 17 1 -7 18 1 -7 19 1 -7 20 1 -7 21 1 -7 22 1 -7 23 1 -7 24 1 -7 25 1 -7 26 1 -7 27 1 -7 28 1 -7 29 1 -7 30 1 -7 31 1 -7 32 1 -7 33 1 -7 34 1 -7 35 1 -7 36 1 -7 37 1 -7 38 1 -7 39 1 -7 40 1 -7 41 1 -7 42 1 -7 43 1 -7 44 1 -7 45 1 -7 46 1 -7 47 1 -7 48 1 -7 49 1 -7 50 1 -7 51 1 -7 52 1 -7 53 1 -7 54 1 -7 55 1 -7 56 1 -7 57 1 -7 58 1 -8 0 0 -8 1 0 -8 2 0 -8 3 0 -8 4 0 -8 5 0 -8 6 0 -8 7 0 -8 8 0 -8 9 1 -8 10 1 -8 11 1 -8 12 1 -8 13 1 -8 14 1 -8 15 1 -8 16 1 -8 17 1 -8 18 1 -8 19 1 -8 20 1 -8 21 1 -8 22 1 -8 23 1 -8 24 1 -8 25 1 -8 26 1 -8 27 1 -8 28 1 -8 29 1 -8 30 1 -8 31 1 -8 32 1 -8 33 1 -8 34 1 -8 35 1 -8 36 1 -8 37 1 -8 38 1 -8 39 1 -8 40 1 -8 41 1 -8 42 1 -8 43 1 -8 44 1 -8 45 1 -8 46 1 -8 47 1 -8 48 1 -8 49 1 -8 50 1 -8 51 1 -8 52 1 -8 53 1 -8 54 1 -8 55 1 -8 56 1 -8 57 1 -8 58 1 -9 0 0 -9 1 0 -9 2 0 -9 3 0 -9 4 0 -9 5 0 -9 6 0 -9 7 0 -9 8 0 -9 9 0 -9 10 1 -9 11 1 -9 12 1 -9 13 1 -9 14 1 -9 15 1 -9 16 1 -9 17 1 -9 18 1 -9 19 1 -9 20 1 -9 21 1 -9 22 1 -9 23 1 -9 24 1 -9 25 1 -9 26 1 -9 27 1 -9 28 1 -9 29 1 -9 30 1 -9 31 1 -9 32 1 -9 33 1 -9 34 1 -9 35 1 -9 36 1 -9 37 1 -9 38 1 -9 39 1 -9 40 1 -9 41 1 -9 42 1 -9 43 1 -9 44 1 -9 45 1 -9 46 1 -9 47 1 -9 48 1 -9 49 1 -9 50 1 -9 51 1 -9 52 1 -9 53 1 -9 54 1 -9 55 1 -9 56 1 -9 57 1 -9 58 1 -10 0 0 -10 1 0 -10 2 0 -10 3 0 -10 4 0 -10 5 0 -10 6 0 -10 7 0 -10 8 0 -10 9 0 -10 10 0 -10 11 1 -10 12 1 -10 13 1 -10 14 1 -10 15 1 -10 16 1 -10 17 1 -10 18 1 -10 19 1 -10 20 1 -10 21 1 -10 22 1 -10 23 1 -10 24 1 -10 25 1 -10 26 1 -10 27 1 -10 28 1 -10 29 1 -10 30 1 -10 31 1 -10 32 1 -10 33 1 -10 34 1 -10 35 1 -10 36 1 -10 37 1 -10 38 1 -10 39 1 -10 40 1 -10 41 1 -10 42 1 -10 43 1 -10 44 1 -10 45 1 -10 46 1 -10 47 1 -10 48 1 -10 49 1 -10 50 1 -10 51 1 -10 52 1 -10 53 1 -10 54 1 -10 55 1 -10 56 1 -10 57 1 -10 58 1 -11 0 0 -11 1 0 -11 2 0 -11 3 0 -11 4 0 -11 5 0 -11 6 0 -11 7 0 -11 8 0 -11 9 0 -11 10 0 -11 11 0 -11 12 1 -11 13 1 -11 14 1 -11 15 1 -11 16 1 -11 17 1 -11 18 1 -11 19 1 -11 20 1 -11 21 1 -11 22 1 -11 23 1 -11 24 1 -11 25 1 -11 26 1 -11 27 1 -11 28 1 -11 29 1 -11 30 1 -11 31 1 -11 32 1 -11 33 1 -11 34 1 -11 35 1 -11 36 1 -11 37 1 -11 38 1 -11 39 1 -11 40 1 -11 41 1 -11 42 1 -11 43 1 -11 44 1 -11 45 1 -11 46 1 -11 47 1 -11 48 1 -11 49 1 -11 50 1 -11 51 1 -11 52 1 -11 53 1 -11 54 1 -11 55 1 -11 56 1 -11 57 1 -11 58 1 -12 0 0 -12 1 0 -12 2 0 -12 3 0 -12 4 0 -12 5 0 -12 6 0 -12 7 0 -12 8 0 -12 9 0 -12 10 0 -12 11 0 -12 12 0 -12 13 1 -12 14 1 -12 15 1 -12 16 1 -12 17 1 -12 18 1 -12 19 1 -12 20 1 -12 21 1 -12 22 1 -12 23 1 -12 24 1 -12 25 1 -12 26 1 -12 27 1 -12 28 1 -12 29 1 -12 30 1 -12 31 1 -12 32 1 -12 33 1 -12 34 1 -12 35 1 -12 36 1 -12 37 1 -12 38 1 -12 39 1 -12 40 1 -12 41 1 -12 42 1 -12 43 1 -12 44 1 -12 45 1 -12 46 1 -12 47 1 -12 48 1 -12 49 1 -12 50 1 -12 51 1 -12 52 1 -12 53 1 -12 54 1 -12 55 1 -12 56 1 -12 57 1 -12 58 1 -13 0 0 -13 1 0 -13 2 0 -13 3 0 -13 4 0 -13 5 0 -13 6 0 -13 7 0 -13 8 0 -13 9 0 -13 10 0 -13 11 0 -13 12 0 -13 13 0 -13 14 1 -13 15 1 -13 16 1 -13 17 1 -13 18 1 -13 19 1 -13 20 1 -13 21 1 -13 22 1 -13 23 1 -13 24 1 -13 25 1 -13 26 1 -13 27 1 -13 28 1 -13 29 1 -13 30 1 -13 31 1 -13 32 1 -13 33 1 -13 34 1 -13 35 1 -13 36 1 -13 37 1 -13 38 1 -13 39 1 -13 40 1 -13 41 1 -13 42 1 -13 43 1 -13 44 1 -13 45 1 -13 46 1 -13 47 1 -13 48 1 -13 49 1 -13 50 1 -13 51 1 -13 52 1 -13 53 1 -13 54 1 -13 55 1 -13 56 1 -13 57 1 -13 58 1 -14 0 0 -14 1 0 -14 2 0 -14 3 0 -14 4 0 -14 5 0 -14 6 0 -14 7 0 -14 8 0 -14 9 0 -14 10 0 -14 11 0 -14 12 0 -14 13 0 -14 14 0 -14 15 1 -14 16 1 -14 17 1 -14 18 1 -14 19 1 -14 20 1 -14 21 1 -14 22 1 -14 23 1 -14 24 1 -14 25 1 -14 26 1 -14 27 1 -14 28 1 -14 29 1 -14 30 1 -14 31 1 -14 32 1 -14 33 1 -14 34 1 -14 35 1 -14 36 1 -14 37 1 -14 38 1 -14 39 1 -14 40 1 -14 41 1 -14 42 1 -14 43 1 -14 44 1 -14 45 1 -14 46 1 -14 47 1 -14 48 1 -14 49 1 -14 50 1 -14 51 1 -14 52 1 -14 53 1 -14 54 1 -14 55 1 -14 56 1 -14 57 1 -14 58 1 -15 0 0 -15 1 0 -15 2 0 -15 3 0 -15 4 0 -15 5 0 -15 6 0 -15 7 0 -15 8 0 -15 9 0 -15 10 0 -15 11 0 -15 12 0 -15 13 0 -15 14 0 -15 15 0 -15 16 1 -15 17 1 -15 18 1 -15 19 1 -15 20 1 -15 21 1 -15 22 1 -15 23 1 -15 24 1 -15 25 1 -15 26 1 -15 27 1 -15 28 1 -15 29 1 -15 30 1 -15 31 1 -15 32 1 -15 33 1 -15 34 1 -15 35 1 -15 36 1 -15 37 1 -15 38 1 -15 39 1 -15 40 1 -15 41 1 -15 42 1 -15 43 1 -15 44 1 -15 45 1 -15 46 1 -15 47 1 -15 48 1 -15 49 1 -15 50 1 -15 51 1 -15 52 1 -15 53 1 -15 54 1 -15 55 1 -15 56 1 -15 57 1 -15 58 1 -16 0 0 -16 1 0 -16 2 0 -16 3 0 -16 4 0 -16 5 0 -16 6 0 -16 7 0 -16 8 0 -16 9 0 -16 10 0 -16 11 0 -16 12 0 -16 13 0 -16 14 0 -16 15 0 -16 16 0 -16 17 1 -16 18 1 -16 19 1 -16 20 1 -16 21 1 -16 22 1 -16 23 1 -16 24 1 -16 25 1 -16 26 1 -16 27 1 -16 28 1 -16 29 1 -16 30 1 -16 31 1 -16 32 1 -16 33 1 -16 34 1 -16 35 1 -16 36 1 -16 37 1 -16 38 1 -16 39 1 -16 40 1 -16 41 1 -16 42 1 -16 43 1 -16 44 1 -16 45 1 -16 46 1 -16 47 1 -16 48 1 -16 49 1 -16 50 1 -16 51 1 -16 52 1 -16 53 1 -16 54 1 -16 55 1 -16 56 1 -16 57 1 -16 58 1 -17 0 0 -17 1 0 -17 2 0 -17 3 0 -17 4 0 -17 5 0 -17 6 0 -17 7 0 -17 8 0 -17 9 0 -17 10 0 -17 11 0 -17 12 0 -17 13 0 -17 14 0 -17 15 0 -17 16 0 -17 17 0 -17 18 1 -17 19 1 -17 20 1 -17 21 1 -17 22 1 -17 23 1 -17 24 1 -17 25 1 -17 26 1 -17 27 1 -17 28 1 -17 29 1 -17 30 1 -17 31 1 -17 32 1 -17 33 1 -17 34 1 -17 35 1 -17 36 1 -17 37 1 -17 38 1 -17 39 1 -17 40 1 -17 41 1 -17 42 1 -17 43 1 -17 44 1 -17 45 1 -17 46 1 -17 47 1 -17 48 1 -17 49 1 -17 50 1 -17 51 1 -17 52 1 -17 53 1 -17 54 1 -17 55 1 -17 56 1 -17 57 1 -17 58 1 -18 0 0 -18 1 0 -18 2 0 -18 3 0 -18 4 0 -18 5 0 -18 6 0 -18 7 0 -18 8 0 -18 9 0 -18 10 0 -18 11 0 -18 12 0 -18 13 0 -18 14 0 -18 15 0 -18 16 0 -18 17 0 -18 18 0 -18 19 1 -18 20 1 -18 21 1 -18 22 1 -18 23 1 -18 24 1 -18 25 1 -18 26 1 -18 27 1 -18 28 1 -18 29 1 -18 30 1 -18 31 1 -18 32 1 -18 33 1 -18 34 1 -18 35 1 -18 36 1 -18 37 1 -18 38 1 -18 39 1 -18 40 1 -18 41 1 -18 42 1 -18 43 1 -18 44 1 -18 45 1 -18 46 1 -18 47 1 -18 48 1 -18 49 1 -18 50 1 -18 51 1 -18 52 1 -18 53 1 -18 54 1 -18 55 1 -18 56 1 -18 57 1 -18 58 1 -19 0 0 -19 1 0 -19 2 0 -19 3 0 -19 4 0 -19 5 0 -19 6 0 -19 7 0 -19 8 0 -19 9 0 -19 10 0 -19 11 0 -19 12 0 -19 13 0 -19 14 0 -19 15 0 -19 16 0 -19 17 0 -19 18 0 -19 19 0 -19 20 1 -19 21 1 -19 22 1 -19 23 1 -19 24 1 -19 25 1 -19 26 1 -19 27 1 -19 28 1 -19 29 1 -19 30 1 -19 31 1 -19 32 1 -19 33 1 -19 34 1 -19 35 1 -19 36 1 -19 37 1 -19 38 1 -19 39 1 -19 40 1 -19 41 1 -19 42 1 -19 43 1 -19 44 1 -19 45 1 -19 46 1 -19 47 1 -19 48 1 -19 49 1 -19 50 1 -19 51 1 -19 52 1 -19 53 1 -19 54 1 -19 55 1 -19 56 1 -19 57 1 -19 58 1 -20 0 0 -20 1 0 -20 2 0 -20 3 0 -20 4 0 -20 5 0 -20 6 0 -20 7 0 -20 8 0 -20 9 0 -20 10 0 -20 11 0 -20 12 0 -20 13 0 -20 14 0 -20 15 0 -20 16 0 -20 17 0 -20 18 0 -20 19 0 -20 20 0 -20 21 1 -20 22 1 -20 23 1 -20 24 1 -20 25 1 -20 26 1 -20 27 1 -20 28 1 -20 29 1 -20 30 1 -20 31 1 -20 32 1 -20 33 1 -20 34 1 -20 35 1 -20 36 1 -20 37 1 -20 38 1 -20 39 1 -20 40 1 -20 41 1 -20 42 1 -20 43 1 -20 44 1 -20 45 1 -20 46 1 -20 47 1 -20 48 1 -20 49 1 -20 50 1 -20 51 1 -20 52 1 -20 53 1 -20 54 1 -20 55 1 -20 56 1 -20 57 1 -20 58 1 -21 0 0 -21 1 0 -21 2 0 -21 3 0 -21 4 0 -21 5 0 -21 6 0 -21 7 0 -21 8 0 -21 9 0 -21 10 0 -21 11 0 -21 12 0 -21 13 0 -21 14 0 -21 15 0 -21 16 0 -21 17 0 -21 18 0 -21 19 0 -21 20 0 -21 21 0 -21 22 1 -21 23 1 -21 24 1 -21 25 1 -21 26 1 -21 27 1 -21 28 1 -21 29 1 -21 30 1 -21 31 1 -21 32 1 -21 33 1 -21 34 1 -21 35 1 -21 36 1 -21 37 1 -21 38 1 -21 39 1 -21 40 1 -21 41 1 -21 42 1 -21 43 1 -21 44 1 -21 45 1 -21 46 1 -21 47 1 -21 48 1 -21 49 1 -21 50 1 -21 51 1 -21 52 1 -21 53 1 -21 54 1 -21 55 1 -21 56 1 -21 57 1 -21 58 1 -22 0 0 -22 1 0 -22 2 0 -22 3 0 -22 4 0 -22 5 0 -22 6 0 -22 7 0 -22 8 0 -22 9 0 -22 10 0 -22 11 0 -22 12 0 -22 13 0 -22 14 0 -22 15 0 -22 16 0 -22 17 0 -22 18 0 -22 19 0 -22 20 0 -22 21 0 -22 22 0 -22 23 1 -22 24 1 -22 25 1 -22 26 1 -22 27 1 -22 28 1 -22 29 1 -22 30 1 -22 31 1 -22 32 1 -22 33 1 -22 34 1 -22 35 1 -22 36 1 -22 37 1 -22 38 1 -22 39 1 -22 40 1 -22 41 1 -22 42 1 -22 43 1 -22 44 1 -22 45 1 -22 46 1 -22 47 1 -22 48 1 -22 49 1 -22 50 1 -22 51 1 -22 52 1 -22 53 1 -22 54 1 -22 55 1 -22 56 1 -22 57 1 -22 58 1 -23 0 0 -23 1 0 -23 2 0 -23 3 0 -23 4 0 -23 5 0 -23 6 0 -23 7 0 -23 8 0 -23 9 0 -23 10 0 -23 11 0 -23 12 0 -23 13 0 -23 14 0 -23 15 0 -23 16 0 -23 17 0 -23 18 0 -23 19 0 -23 20 0 -23 21 0 -23 22 0 -23 23 0 -23 24 1 -23 25 1 -23 26 1 -23 27 1 -23 28 1 -23 29 1 -23 30 1 -23 31 1 -23 32 1 -23 33 1 -23 34 1 -23 35 1 -23 36 1 -23 37 1 -23 38 1 -23 39 1 -23 40 1 -23 41 1 -23 42 1 -23 43 1 -23 44 1 -23 45 1 -23 46 1 -23 47 1 -23 48 1 -23 49 1 -23 50 1 -23 51 1 -23 52 1 -23 53 1 -23 54 1 -23 55 1 -23 56 1 -23 57 1 -23 58 1 -24 0 0 -24 1 0 -24 2 0 -24 3 0 -24 4 0 -24 5 0 -24 6 0 -24 7 0 -24 8 0 -24 9 0 -24 10 0 -24 11 0 -24 12 0 -24 13 0 -24 14 0 -24 15 0 -24 16 0 -24 17 0 -24 18 0 -24 19 0 -24 20 0 -24 21 0 -24 22 0 -24 23 0 -24 24 0 -24 25 1 -24 26 1 -24 27 1 -24 28 1 -24 29 1 -24 30 1 -24 31 1 -24 32 1 -24 33 1 -24 34 1 -24 35 1 -24 36 1 -24 37 1 -24 38 1 -24 39 1 -24 40 1 -24 41 1 -24 42 1 -24 43 1 -24 44 1 -24 45 1 -24 46 1 -24 47 1 -24 48 1 -24 49 1 -24 50 1 -24 51 1 -24 52 1 -24 53 1 -24 54 1 -24 55 1 -24 56 1 -24 57 1 -24 58 1 -25 0 0 -25 1 0 -25 2 0 -25 3 0 -25 4 0 -25 5 0 -25 6 0 -25 7 0 -25 8 0 -25 9 0 -25 10 0 -25 11 0 -25 12 0 -25 13 0 -25 14 0 -25 15 0 -25 16 0 -25 17 0 -25 18 0 -25 19 0 -25 20 0 -25 21 0 -25 22 0 -25 23 0 -25 24 0 -25 25 0 -25 26 1 -25 27 1 -25 28 1 -25 29 1 -25 30 1 -25 31 1 -25 32 1 -25 33 1 -25 34 1 -25 35 1 -25 36 1 -25 37 1 -25 38 1 -25 39 1 -25 40 1 -25 41 1 -25 42 1 -25 43 1 -25 44 1 -25 45 1 -25 46 1 -25 47 1 -25 48 1 -25 49 1 -25 50 1 -25 51 1 -25 52 1 -25 53 1 -25 54 1 -25 55 1 -25 56 1 -25 57 1 -25 58 1 -26 0 0 -26 1 0 -26 2 0 -26 3 0 -26 4 0 -26 5 0 -26 6 0 -26 7 0 -26 8 0 -26 9 0 -26 10 0 -26 11 0 -26 12 0 -26 13 0 -26 14 0 -26 15 0 -26 16 0 -26 17 0 -26 18 0 -26 19 0 -26 20 0 -26 21 0 -26 22 0 -26 23 0 -26 24 0 -26 25 0 -26 26 0 -26 27 1 -26 28 1 -26 29 1 -26 30 1 -26 31 1 -26 32 1 -26 33 1 -26 34 1 -26 35 1 -26 36 1 -26 37 1 -26 38 1 -26 39 1 -26 40 1 -26 41 1 -26 42 1 -26 43 1 -26 44 1 -26 45 1 -26 46 1 -26 47 1 -26 48 1 -26 49 1 -26 50 1 -26 51 1 -26 52 1 -26 53 1 -26 54 1 -26 55 1 -26 56 1 -26 57 1 -26 58 1 -27 0 0 -27 1 0 -27 2 0 -27 3 0 -27 4 0 -27 5 0 -27 6 0 -27 7 0 -27 8 0 -27 9 0 -27 10 0 -27 11 0 -27 12 0 -27 13 0 -27 14 0 -27 15 0 -27 16 0 -27 17 0 -27 18 0 -27 19 0 -27 20 0 -27 21 0 -27 22 0 -27 23 0 -27 24 0 -27 25 0 -27 26 0 -27 27 0 -27 28 1 -27 29 1 -27 30 1 -27 31 1 -27 32 1 -27 33 1 -27 34 1 -27 35 1 -27 36 1 -27 37 1 -27 38 1 -27 39 1 -27 40 1 -27 41 1 -27 42 1 -27 43 1 -27 44 1 -27 45 1 -27 46 1 -27 47 1 -27 48 1 -27 49 1 -27 50 1 -27 51 1 -27 52 1 -27 53 1 -27 54 1 -27 55 1 -27 56 1 -27 57 1 -27 58 1 -28 0 0 -28 1 0 -28 2 0 -28 3 0 -28 4 0 -28 5 0 -28 6 0 -28 7 0 -28 8 0 -28 9 0 -28 10 0 -28 11 0 -28 12 0 -28 13 0 -28 14 0 -28 15 0 -28 16 0 -28 17 0 -28 18 0 -28 19 0 -28 20 0 -28 21 0 -28 22 0 -28 23 0 -28 24 0 -28 25 0 -28 26 0 -28 27 0 -28 28 0 -28 29 1 -28 30 0 -28 31 0 -28 32 0 -28 33 0 -28 34 0 -28 35 0 -28 36 0 -28 37 0 -28 38 0 -28 39 0 -28 40 0 -28 41 0 -28 42 0 -28 43 0 -28 44 0 -28 45 0 -28 46 0 -28 47 0 -28 48 0 -28 49 0 -28 50 0 -28 51 0 -28 52 0 -28 53 0 -28 54 0 -28 55 0 -28 56 0 -28 57 0 -28 58 0 -29 0 0 -29 1 0 -29 2 0 -29 3 0 -29 4 0 -29 5 0 -29 6 0 -29 7 0 -29 8 0 -29 9 0 -29 10 0 -29 11 0 -29 12 0 -29 13 0 -29 14 0 -29 15 0 -29 16 0 -29 17 0 -29 18 0 -29 19 0 -29 20 0 -29 21 0 -29 22 0 -29 23 0 -29 24 0 -29 25 0 -29 26 0 -29 27 0 -29 28 1 -29 29 0 -29 30 1 -29 31 0 -29 32 0 -29 33 0 -29 34 0 -29 35 0 -29 36 0 -29 37 0 -29 38 0 -29 39 0 -29 40 0 -29 41 0 -29 42 0 -29 43 0 -29 44 0 -29 45 0 -29 46 0 -29 47 0 -29 48 0 -29 49 0 -29 50 0 -29 51 0 -29 52 0 -29 53 0 -29 54 0 -29 55 0 -29 56 0 -29 57 0 -29 58 0 -30 0 0 -30 1 0 -30 2 0 -30 3 0 -30 4 0 -30 5 0 -30 6 0 -30 7 0 -30 8 0 -30 9 0 -30 10 0 -30 11 0 -30 12 0 -30 13 0 -30 14 0 -30 15 0 -30 16 0 -30 17 0 -30 18 0 -30 19 0 -30 20 0 -30 21 0 -30 22 0 -30 23 0 -30 24 0 -30 25 0 -30 26 0 -30 27 0 -30 28 1 -30 29 1 -30 30 0 -30 31 1 -30 32 0 -30 33 0 -30 34 0 -30 35 0 -30 36 0 -30 37 0 -30 38 0 -30 39 0 -30 40 0 -30 41 0 -30 42 0 -30 43 0 -30 44 0 -30 45 0 -30 46 0 -30 47 0 -30 48 0 -30 49 0 -30 50 0 -30 51 0 -30 52 0 -30 53 0 -30 54 0 -30 55 0 -30 56 0 -30 57 0 -30 58 0 -31 0 0 -31 1 0 -31 2 0 -31 3 0 -31 4 0 -31 5 0 -31 6 0 -31 7 0 -31 8 0 -31 9 0 -31 10 0 -31 11 0 -31 12 0 -31 13 0 -31 14 0 -31 15 0 -31 16 0 -31 17 0 -31 18 0 -31 19 0 -31 20 0 -31 21 0 -31 22 0 -31 23 0 -31 24 0 -31 25 0 -31 26 0 -31 27 0 -31 28 1 -31 29 1 -31 30 1 -31 31 0 -31 32 1 -31 33 0 -31 34 0 -31 35 0 -31 36 0 -31 37 0 -31 38 0 -31 39 0 -31 40 0 -31 41 0 -31 42 0 -31 43 0 -31 44 0 -31 45 0 -31 46 0 -31 47 0 -31 48 0 -31 49 0 -31 50 0 -31 51 0 -31 52 0 -31 53 0 -31 54 0 -31 55 0 -31 56 0 -31 57 0 -31 58 0 -32 0 0 -32 1 0 -32 2 0 -32 3 0 -32 4 0 -32 5 0 -32 6 0 -32 7 0 -32 8 0 -32 9 0 -32 10 0 -32 11 0 -32 12 0 -32 13 0 -32 14 0 -32 15 0 -32 16 0 -32 17 0 -32 18 0 -32 19 0 -32 20 0 -32 21 0 -32 22 0 -32 23 0 -32 24 0 -32 25 0 -32 26 0 -32 27 0 -32 28 1 -32 29 1 -32 30 1 -32 31 1 -32 32 0 -32 33 1 -32 34 0 -32 35 0 -32 36 0 -32 37 0 -32 38 0 -32 39 0 -32 40 0 -32 41 0 -32 42 0 -32 43 0 -32 44 0 -32 45 0 -32 46 0 -32 47 0 -32 48 0 -32 49 0 -32 50 0 -32 51 0 -32 52 0 -32 53 0 -32 54 0 -32 55 0 -32 56 0 -32 57 0 -32 58 0 -33 0 0 -33 1 0 -33 2 0 -33 3 0 -33 4 0 -33 5 0 -33 6 0 -33 7 0 -33 8 0 -33 9 0 -33 10 0 -33 11 0 -33 12 0 -33 13 0 -33 14 0 -33 15 0 -33 16 0 -33 17 0 -33 18 0 -33 19 0 -33 20 0 -33 21 0 -33 22 0 -33 23 0 -33 24 0 -33 25 0 -33 26 0 -33 27 0 -33 28 1 -33 29 1 -33 30 1 -33 31 1 -33 32 1 -33 33 0 -33 34 1 -33 35 0 -33 36 0 -33 37 0 -33 38 0 -33 39 0 -33 40 0 -33 41 0 -33 42 0 -33 43 0 -33 44 0 -33 45 0 -33 46 0 -33 47 0 -33 48 0 -33 49 0 -33 50 0 -33 51 0 -33 52 0 -33 53 0 -33 54 0 -33 55 0 -33 56 0 -33 57 0 -33 58 0 -34 0 0 -34 1 0 -34 2 0 -34 3 0 -34 4 0 -34 5 0 -34 6 0 -34 7 0 -34 8 0 -34 9 0 -34 10 0 -34 11 0 -34 12 0 -34 13 0 -34 14 0 -34 15 0 -34 16 0 -34 17 0 -34 18 0 -34 19 0 -34 20 0 -34 21 0 -34 22 0 -34 23 0 -34 24 0 -34 25 0 -34 26 0 -34 27 0 -34 28 1 -34 29 1 -34 30 1 -34 31 1 -34 32 1 -34 33 1 -34 34 0 -34 35 1 -34 36 0 -34 37 0 -34 38 0 -34 39 0 -34 40 0 -34 41 0 -34 42 0 -34 43 0 -34 44 0 -34 45 0 -34 46 0 -34 47 0 -34 48 0 -34 49 0 -34 50 0 -34 51 0 -34 52 0 -34 53 0 -34 54 0 -34 55 0 -34 56 0 -34 57 0 -34 58 0 -35 0 0 -35 1 0 -35 2 0 -35 3 0 -35 4 0 -35 5 0 -35 6 0 -35 7 0 -35 8 0 -35 9 0 -35 10 0 -35 11 0 -35 12 0 -35 13 0 -35 14 0 -35 15 0 -35 16 0 -35 17 0 -35 18 0 -35 19 0 -35 20 0 -35 21 0 -35 22 0 -35 23 0 -35 24 0 -35 25 0 -35 26 0 -35 27 0 -35 28 1 -35 29 1 -35 30 1 -35 31 1 -35 32 1 -35 33 1 -35 34 1 -35 35 0 -35 36 1 -35 37 0 -35 38 0 -35 39 0 -35 40 0 -35 41 0 -35 42 0 -35 43 0 -35 44 0 -35 45 0 -35 46 0 -35 47 0 -35 48 0 -35 49 0 -35 50 0 -35 51 0 -35 52 0 -35 53 0 -35 54 0 -35 55 0 -35 56 0 -35 57 0 -35 58 0 -36 0 0 -36 1 0 -36 2 0 -36 3 0 -36 4 0 -36 5 0 -36 6 0 -36 7 0 -36 8 0 -36 9 0 -36 10 0 -36 11 0 -36 12 0 -36 13 0 -36 14 0 -36 15 0 -36 16 0 -36 17 0 -36 18 0 -36 19 0 -36 20 0 -36 21 0 -36 22 0 -36 23 0 -36 24 0 -36 25 0 -36 26 0 -36 27 0 -36 28 1 -36 29 1 -36 30 1 -36 31 1 -36 32 1 -36 33 1 -36 34 1 -36 35 1 -36 36 0 -36 37 1 -36 38 0 -36 39 0 -36 40 0 -36 41 0 -36 42 0 -36 43 0 -36 44 0 -36 45 0 -36 46 0 -36 47 0 -36 48 0 -36 49 0 -36 50 0 -36 51 0 -36 52 0 -36 53 0 -36 54 0 -36 55 0 -36 56 0 -36 57 0 -36 58 0 -37 0 0 -37 1 0 -37 2 0 -37 3 0 -37 4 0 -37 5 0 -37 6 0 -37 7 0 -37 8 0 -37 9 0 -37 10 0 -37 11 0 -37 12 0 -37 13 0 -37 14 0 -37 15 0 -37 16 0 -37 17 0 -37 18 0 -37 19 0 -37 20 0 -37 21 0 -37 22 0 -37 23 0 -37 24 0 -37 25 0 -37 26 0 -37 27 0 -37 28 1 -37 29 1 -37 30 1 -37 31 1 -37 32 1 -37 33 1 -37 34 1 -37 35 1 -37 36 1 -37 37 0 -37 38 1 -37 39 0 -37 40 0 -37 41 0 -37 42 0 -37 43 0 -37 44 0 -37 45 0 -37 46 0 -37 47 0 -37 48 0 -37 49 0 -37 50 0 -37 51 0 -37 52 0 -37 53 0 -37 54 0 -37 55 0 -37 56 0 -37 57 0 -37 58 0 -38 0 0 -38 1 0 -38 2 0 -38 3 0 -38 4 0 -38 5 0 -38 6 0 -38 7 0 -38 8 0 -38 9 0 -38 10 0 -38 11 0 -38 12 0 -38 13 0 -38 14 0 -38 15 0 -38 16 0 -38 17 0 -38 18 0 -38 19 0 -38 20 0 -38 21 0 -38 22 0 -38 23 0 -38 24 0 -38 25 0 -38 26 0 -38 27 0 -38 28 1 -38 29 1 -38 30 1 -38 31 1 -38 32 1 -38 33 1 -38 34 1 -38 35 1 -38 36 1 -38 37 1 -38 38 0 -38 39 1 -38 40 0 -38 41 0 -38 42 0 -38 43 0 -38 44 0 -38 45 0 -38 46 0 -38 47 0 -38 48 0 -38 49 0 -38 50 0 -38 51 0 -38 52 0 -38 53 0 -38 54 0 -38 55 0 -38 56 0 -38 57 0 -38 58 0 -39 0 0 -39 1 0 -39 2 0 -39 3 0 -39 4 0 -39 5 0 -39 6 0 -39 7 0 -39 8 0 -39 9 0 -39 10 0 -39 11 0 -39 12 0 -39 13 0 -39 14 0 -39 15 0 -39 16 0 -39 17 0 -39 18 0 -39 19 0 -39 20 0 -39 21 0 -39 22 0 -39 23 0 -39 24 0 -39 25 0 -39 26 0 -39 27 0 -39 28 1 -39 29 1 -39 30 1 -39 31 1 -39 32 1 -39 33 1 -39 34 1 -39 35 1 -39 36 1 -39 37 1 -39 38 1 -39 39 0 -39 40 1 -39 41 0 -39 42 0 -39 43 0 -39 44 0 -39 45 0 -39 46 0 -39 47 0 -39 48 0 -39 49 0 -39 50 0 -39 51 0 -39 52 0 -39 53 0 -39 54 0 -39 55 0 -39 56 0 -39 57 0 -39 58 0 -40 0 0 -40 1 0 -40 2 0 -40 3 0 -40 4 0 -40 5 0 -40 6 0 -40 7 0 -40 8 0 -40 9 0 -40 10 0 -40 11 0 -40 12 0 -40 13 0 -40 14 0 -40 15 0 -40 16 0 -40 17 0 -40 18 0 -40 19 0 -40 20 0 -40 21 0 -40 22 0 -40 23 0 -40 24 0 -40 25 0 -40 26 0 -40 27 0 -40 28 1 -40 29 1 -40 30 1 -40 31 1 -40 32 1 -40 33 1 -40 34 1 -40 35 1 -40 36 1 -40 37 1 -40 38 1 -40 39 1 -40 40 0 -40 41 1 -40 42 0 -40 43 0 -40 44 0 -40 45 0 -40 46 0 -40 47 0 -40 48 0 -40 49 0 -40 50 0 -40 51 0 -40 52 0 -40 53 0 -40 54 0 -40 55 0 -40 56 0 -40 57 0 -40 58 0 -41 0 0 -41 1 0 -41 2 0 -41 3 0 -41 4 0 -41 5 0 -41 6 0 -41 7 0 -41 8 0 -41 9 0 -41 10 0 -41 11 0 -41 12 0 -41 13 0 -41 14 0 -41 15 0 -41 16 0 -41 17 0 -41 18 0 -41 19 0 -41 20 0 -41 21 0 -41 22 0 -41 23 0 -41 24 0 -41 25 0 -41 26 0 -41 27 0 -41 28 1 -41 29 1 -41 30 1 -41 31 1 -41 32 1 -41 33 1 -41 34 1 -41 35 1 -41 36 1 -41 37 1 -41 38 1 -41 39 1 -41 40 1 -41 41 0 -41 42 1 -41 43 0 -41 44 0 -41 45 0 -41 46 0 -41 47 0 -41 48 0 -41 49 0 -41 50 0 -41 51 0 -41 52 0 -41 53 0 -41 54 0 -41 55 0 -41 56 0 -41 57 0 -41 58 0 -42 0 0 -42 1 0 -42 2 0 -42 3 0 -42 4 0 -42 5 0 -42 6 0 -42 7 0 -42 8 0 -42 9 0 -42 10 0 -42 11 0 -42 12 0 -42 13 0 -42 14 0 -42 15 0 -42 16 0 -42 17 0 -42 18 0 -42 19 0 -42 20 0 -42 21 0 -42 22 0 -42 23 0 -42 24 0 -42 25 0 -42 26 0 -42 27 0 -42 28 1 -42 29 1 -42 30 1 -42 31 1 -42 32 1 -42 33 1 -42 34 1 -42 35 1 -42 36 1 -42 37 1 -42 38 1 -42 39 1 -42 40 1 -42 41 1 -42 42 0 -42 43 1 -42 44 0 -42 45 0 -42 46 0 -42 47 0 -42 48 0 -42 49 0 -42 50 0 -42 51 0 -42 52 0 -42 53 0 -42 54 0 -42 55 0 -42 56 0 -42 57 0 -42 58 0 -43 0 0 -43 1 0 -43 2 0 -43 3 0 -43 4 0 -43 5 0 -43 6 0 -43 7 0 -43 8 0 -43 9 0 -43 10 0 -43 11 0 -43 12 0 -43 13 0 -43 14 0 -43 15 0 -43 16 0 -43 17 0 -43 18 0 -43 19 0 -43 20 0 -43 21 0 -43 22 0 -43 23 0 -43 24 0 -43 25 0 -43 26 0 -43 27 0 -43 28 1 -43 29 1 -43 30 1 -43 31 1 -43 32 1 -43 33 1 -43 34 1 -43 35 1 -43 36 1 -43 37 1 -43 38 1 -43 39 1 -43 40 1 -43 41 1 -43 42 1 -43 43 0 -43 44 1 -43 45 0 -43 46 0 -43 47 0 -43 48 0 -43 49 0 -43 50 0 -43 51 0 -43 52 0 -43 53 0 -43 54 0 -43 55 0 -43 56 0 -43 57 0 -43 58 0 -44 0 0 -44 1 0 -44 2 0 -44 3 0 -44 4 0 -44 5 0 -44 6 0 -44 7 0 -44 8 0 -44 9 0 -44 10 0 -44 11 0 -44 12 0 -44 13 0 -44 14 0 -44 15 0 -44 16 0 -44 17 0 -44 18 0 -44 19 0 -44 20 0 -44 21 0 -44 22 0 -44 23 0 -44 24 0 -44 25 0 -44 26 0 -44 27 0 -44 28 1 -44 29 1 -44 30 1 -44 31 1 -44 32 1 -44 33 1 -44 34 1 -44 35 1 -44 36 1 -44 37 1 -44 38 1 -44 39 1 -44 40 1 -44 41 1 -44 42 1 -44 43 1 -44 44 0 -44 45 1 -44 46 0 -44 47 0 -44 48 0 -44 49 0 -44 50 0 -44 51 0 -44 52 0 -44 53 0 -44 54 0 -44 55 0 -44 56 0 -44 57 0 -44 58 0 -45 0 0 -45 1 0 -45 2 0 -45 3 0 -45 4 0 -45 5 0 -45 6 0 -45 7 0 -45 8 0 -45 9 0 -45 10 0 -45 11 0 -45 12 0 -45 13 0 -45 14 0 -45 15 0 -45 16 0 -45 17 0 -45 18 0 -45 19 0 -45 20 0 -45 21 0 -45 22 0 -45 23 0 -45 24 0 -45 25 0 -45 26 0 -45 27 0 -45 28 1 -45 29 1 -45 30 1 -45 31 1 -45 32 1 -45 33 1 -45 34 1 -45 35 1 -45 36 1 -45 37 1 -45 38 1 -45 39 1 -45 40 1 -45 41 1 -45 42 1 -45 43 1 -45 44 1 -45 45 0 -45 46 1 -45 47 0 -45 48 0 -45 49 0 -45 50 0 -45 51 0 -45 52 0 -45 53 0 -45 54 0 -45 55 0 -45 56 0 -45 57 0 -45 58 0 -46 0 0 -46 1 0 -46 2 0 -46 3 0 -46 4 0 -46 5 0 -46 6 0 -46 7 0 -46 8 0 -46 9 0 -46 10 0 -46 11 0 -46 12 0 -46 13 0 -46 14 0 -46 15 0 -46 16 0 -46 17 0 -46 18 0 -46 19 0 -46 20 0 -46 21 0 -46 22 0 -46 23 0 -46 24 0 -46 25 0 -46 26 0 -46 27 0 -46 28 1 -46 29 1 -46 30 1 -46 31 1 -46 32 1 -46 33 1 -46 34 1 -46 35 1 -46 36 1 -46 37 1 -46 38 1 -46 39 1 -46 40 1 -46 41 1 -46 42 1 -46 43 1 -46 44 1 -46 45 1 -46 46 0 -46 47 1 -46 48 0 -46 49 0 -46 50 0 -46 51 0 -46 52 0 -46 53 0 -46 54 0 -46 55 0 -46 56 0 -46 57 0 -46 58 0 -47 0 0 -47 1 0 -47 2 0 -47 3 0 -47 4 0 -47 5 0 -47 6 0 -47 7 0 -47 8 0 -47 9 0 -47 10 0 -47 11 0 -47 12 0 -47 13 0 -47 14 0 -47 15 0 -47 16 0 -47 17 0 -47 18 0 -47 19 0 -47 20 0 -47 21 0 -47 22 0 -47 23 0 -47 24 0 -47 25 0 -47 26 0 -47 27 0 -47 28 1 -47 29 1 -47 30 1 -47 31 1 -47 32 1 -47 33 1 -47 34 1 -47 35 1 -47 36 1 -47 37 1 -47 38 1 -47 39 1 -47 40 1 -47 41 1 -47 42 1 -47 43 1 -47 44 1 -47 45 1 -47 46 1 -47 47 0 -47 48 1 -47 49 0 -47 50 0 -47 51 0 -47 52 0 -47 53 0 -47 54 0 -47 55 0 -47 56 0 -47 57 0 -47 58 0 -48 0 0 -48 1 0 -48 2 0 -48 3 0 -48 4 0 -48 5 0 -48 6 0 -48 7 0 -48 8 0 -48 9 0 -48 10 0 -48 11 0 -48 12 0 -48 13 0 -48 14 0 -48 15 0 -48 16 0 -48 17 0 -48 18 0 -48 19 0 -48 20 0 -48 21 0 -48 22 0 -48 23 0 -48 24 0 -48 25 0 -48 26 0 -48 27 0 -48 28 1 -48 29 1 -48 30 1 -48 31 1 -48 32 1 -48 33 1 -48 34 1 -48 35 1 -48 36 1 -48 37 1 -48 38 1 -48 39 1 -48 40 1 -48 41 1 -48 42 1 -48 43 1 -48 44 1 -48 45 1 -48 46 1 -48 47 1 -48 48 0 -48 49 1 -48 50 0 -48 51 0 -48 52 0 -48 53 0 -48 54 0 -48 55 0 -48 56 0 -48 57 0 -48 58 0 -49 0 0 -49 1 0 -49 2 0 -49 3 0 -49 4 0 -49 5 0 -49 6 0 -49 7 0 -49 8 0 -49 9 0 -49 10 0 -49 11 0 -49 12 0 -49 13 0 -49 14 0 -49 15 0 -49 16 0 -49 17 0 -49 18 0 -49 19 0 -49 20 0 -49 21 0 -49 22 0 -49 23 0 -49 24 0 -49 25 0 -49 26 0 -49 27 0 -49 28 1 -49 29 1 -49 30 1 -49 31 1 -49 32 1 -49 33 1 -49 34 1 -49 35 1 -49 36 1 -49 37 1 -49 38 1 -49 39 1 -49 40 1 -49 41 1 -49 42 1 -49 43 1 -49 44 1 -49 45 1 -49 46 1 -49 47 1 -49 48 1 -49 49 0 -49 50 1 -49 51 0 -49 52 0 -49 53 0 -49 54 0 -49 55 0 -49 56 0 -49 57 0 -49 58 0 -50 0 0 -50 1 0 -50 2 0 -50 3 0 -50 4 0 -50 5 0 -50 6 0 -50 7 0 -50 8 0 -50 9 0 -50 10 0 -50 11 0 -50 12 0 -50 13 0 -50 14 0 -50 15 0 -50 16 0 -50 17 0 -50 18 0 -50 19 0 -50 20 0 -50 21 0 -50 22 0 -50 23 0 -50 24 0 -50 25 0 -50 26 0 -50 27 0 -50 28 1 -50 29 1 -50 30 1 -50 31 1 -50 32 1 -50 33 1 -50 34 1 -50 35 1 -50 36 1 -50 37 1 -50 38 1 -50 39 1 -50 40 1 -50 41 1 -50 42 1 -50 43 1 -50 44 1 -50 45 1 -50 46 1 -50 47 1 -50 48 1 -50 49 1 -50 50 0 -50 51 1 -50 52 0 -50 53 0 -50 54 0 -50 55 0 -50 56 0 -50 57 0 -50 58 0 -51 0 0 -51 1 0 -51 2 0 -51 3 0 -51 4 0 -51 5 0 -51 6 0 -51 7 0 -51 8 0 -51 9 0 -51 10 0 -51 11 0 -51 12 0 -51 13 0 -51 14 0 -51 15 0 -51 16 0 -51 17 0 -51 18 0 -51 19 0 -51 20 0 -51 21 0 -51 22 0 -51 23 0 -51 24 0 -51 25 0 -51 26 0 -51 27 0 -51 28 1 -51 29 1 -51 30 1 -51 31 1 -51 32 1 -51 33 1 -51 34 1 -51 35 1 -51 36 1 -51 37 1 -51 38 1 -51 39 1 -51 40 1 -51 41 1 -51 42 1 -51 43 1 -51 44 1 -51 45 1 -51 46 1 -51 47 1 -51 48 1 -51 49 1 -51 50 1 -51 51 0 -51 52 1 -51 53 0 -51 54 0 -51 55 0 -51 56 0 -51 57 0 -51 58 0 -52 0 0 -52 1 0 -52 2 0 -52 3 0 -52 4 0 -52 5 0 -52 6 0 -52 7 0 -52 8 0 -52 9 0 -52 10 0 -52 11 0 -52 12 0 -52 13 0 -52 14 0 -52 15 0 -52 16 0 -52 17 0 -52 18 0 -52 19 0 -52 20 0 -52 21 0 -52 22 0 -52 23 0 -52 24 0 -52 25 0 -52 26 0 -52 27 0 -52 28 1 -52 29 1 -52 30 1 -52 31 1 -52 32 1 -52 33 1 -52 34 1 -52 35 1 -52 36 1 -52 37 1 -52 38 1 -52 39 1 -52 40 1 -52 41 1 -52 42 1 -52 43 1 -52 44 1 -52 45 1 -52 46 1 -52 47 1 -52 48 1 -52 49 1 -52 50 1 -52 51 1 -52 52 0 -52 53 1 -52 54 0 -52 55 0 -52 56 0 -52 57 0 -52 58 0 -53 0 0 -53 1 0 -53 2 0 -53 3 0 -53 4 0 -53 5 0 -53 6 0 -53 7 0 -53 8 0 -53 9 0 -53 10 0 -53 11 0 -53 12 0 -53 13 0 -53 14 0 -53 15 0 -53 16 0 -53 17 0 -53 18 0 -53 19 0 -53 20 0 -53 21 0 -53 22 0 -53 23 0 -53 24 0 -53 25 0 -53 26 0 -53 27 0 -53 28 1 -53 29 1 -53 30 1 -53 31 1 -53 32 1 -53 33 1 -53 34 1 -53 35 1 -53 36 1 -53 37 1 -53 38 1 -53 39 1 -53 40 1 -53 41 1 -53 42 1 -53 43 1 -53 44 1 -53 45 1 -53 46 1 -53 47 1 -53 48 1 -53 49 1 -53 50 1 -53 51 1 -53 52 1 -53 53 0 -53 54 1 -53 55 0 -53 56 0 -53 57 0 -53 58 0 -54 0 0 -54 1 0 -54 2 0 -54 3 0 -54 4 0 -54 5 0 -54 6 0 -54 7 0 -54 8 0 -54 9 0 -54 10 0 -54 11 0 -54 12 0 -54 13 0 -54 14 0 -54 15 0 -54 16 0 -54 17 0 -54 18 0 -54 19 0 -54 20 0 -54 21 0 -54 22 0 -54 23 0 -54 24 0 -54 25 0 -54 26 0 -54 27 0 -54 28 1 -54 29 1 -54 30 1 -54 31 1 -54 32 1 -54 33 1 -54 34 1 -54 35 1 -54 36 1 -54 37 1 -54 38 1 -54 39 1 -54 40 1 -54 41 1 -54 42 1 -54 43 1 -54 44 1 -54 45 1 -54 46 1 -54 47 1 -54 48 1 -54 49 1 -54 50 1 -54 51 1 -54 52 1 -54 53 1 -54 54 0 -54 55 1 -54 56 0 -54 57 0 -54 58 0 -55 0 0 -55 1 0 -55 2 0 -55 3 0 -55 4 0 -55 5 0 -55 6 0 -55 7 0 -55 8 0 -55 9 0 -55 10 0 -55 11 0 -55 12 0 -55 13 0 -55 14 0 -55 15 0 -55 16 0 -55 17 0 -55 18 0 -55 19 0 -55 20 0 -55 21 0 -55 22 0 -55 23 0 -55 24 0 -55 25 0 -55 26 0 -55 27 0 -55 28 1 -55 29 1 -55 30 1 -55 31 1 -55 32 1 -55 33 1 -55 34 1 -55 35 1 -55 36 1 -55 37 1 -55 38 1 -55 39 1 -55 40 1 -55 41 1 -55 42 1 -55 43 1 -55 44 1 -55 45 1 -55 46 1 -55 47 1 -55 48 1 -55 49 1 -55 50 1 -55 51 1 -55 52 1 -55 53 1 -55 54 1 -55 55 0 -55 56 1 -55 57 0 -55 58 0 -56 0 0 -56 1 0 -56 2 0 -56 3 0 -56 4 0 -56 5 0 -56 6 0 -56 7 0 -56 8 0 -56 9 0 -56 10 0 -56 11 0 -56 12 0 -56 13 0 -56 14 0 -56 15 0 -56 16 0 -56 17 0 -56 18 0 -56 19 0 -56 20 0 -56 21 0 -56 22 0 -56 23 0 -56 24 0 -56 25 0 -56 26 0 -56 27 0 -56 28 1 -56 29 1 -56 30 1 -56 31 1 -56 32 1 -56 33 1 -56 34 1 -56 35 1 -56 36 1 -56 37 1 -56 38 1 -56 39 1 -56 40 1 -56 41 1 -56 42 1 -56 43 1 -56 44 1 -56 45 1 -56 46 1 -56 47 1 -56 48 1 -56 49 1 -56 50 1 -56 51 1 -56 52 1 -56 53 1 -56 54 1 -56 55 1 -56 56 0 -56 57 1 -56 58 0 -57 0 0 -57 1 0 -57 2 0 -57 3 0 -57 4 0 -57 5 0 -57 6 0 -57 7 0 -57 8 0 -57 9 0 -57 10 0 -57 11 0 -57 12 0 -57 13 0 -57 14 0 -57 15 0 -57 16 0 -57 17 0 -57 18 0 -57 19 0 -57 20 0 -57 21 0 -57 22 0 -57 23 0 -57 24 0 -57 25 0 -57 26 0 -57 27 0 -57 28 1 -57 29 1 -57 30 1 -57 31 1 -57 32 1 -57 33 1 -57 34 1 -57 35 1 -57 36 1 -57 37 1 -57 38 1 -57 39 1 -57 40 1 -57 41 1 -57 42 1 -57 43 1 -57 44 1 -57 45 1 -57 46 1 -57 47 1 -57 48 1 -57 49 1 -57 50 1 -57 51 1 -57 52 1 -57 53 1 -57 54 1 -57 55 1 -57 56 1 -57 57 0 -57 58 1 -58 0 0 -58 1 0 -58 2 0 -58 3 0 -58 4 0 -58 5 0 -58 6 0 -58 7 0 -58 8 0 -58 9 0 -58 10 0 -58 11 0 -58 12 0 -58 13 0 -58 14 0 -58 15 0 -58 16 0 -58 17 0 -58 18 0 -58 19 0 -58 20 0 -58 21 0 -58 22 0 -58 23 0 -58 24 0 -58 25 0 -58 26 0 -58 27 0 -58 28 1 -58 29 1 -58 30 1 -58 31 1 -58 32 1 -58 33 1 -58 34 1 -58 35 1 -58 36 1 -58 37 1 -58 38 1 -58 39 1 -58 40 1 -58 41 1 -58 42 1 -58 43 1 -58 44 1 -58 45 1 -58 46 1 -58 47 1 -58 48 1 -58 49 1 -58 50 1 -58 51 1 -58 52 1 -58 53 1 -58 54 1 -58 55 1 -58 56 1 -58 57 1 -58 58 0 -)"; - -#endif // TEST_LIBCXX_ALGORITHMS_ALG_SORTING_ASSERT_SORT_INVALID_COMPARATOR_BAD_COMPARATOR_VALUES_H diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/invalid_comparator_utilities.h b/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/invalid_comparator_utilities.h deleted file mode 100644 index f5e6025..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/assert.sort.invalid_comparator/invalid_comparator_utilities.h +++ /dev/null @@ -1,85 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_ALGORITHMS_ALG_SORTING_ASSERT_SORT_INVALID_COMPARATOR_INVALID_COMPARATOR_UTILITIES_H -#define TEST_LIBCXX_ALGORITHMS_ALG_SORTING_ASSERT_SORT_INVALID_COMPARATOR_INVALID_COMPARATOR_UTILITIES_H - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <map> -#include <ranges> -#include <set> -#include <string> -#include <string_view> -#include <vector> - -class ComparisonResults { -public: - explicit ComparisonResults(std::string_view data) { - for (auto line : - std::views::split(data, '\n') | std::views::filter([](auto const& line) { return !line.empty(); })) { - auto values = std::views::split(line, ' '); - auto it = values.begin(); - std::size_t left = std::stol(std::string((*it).data(), (*it).size())); - it = std::next(it); - std::size_t right = std::stol(std::string((*it).data(), (*it).size())); - it = std::next(it); - bool result = static_cast<bool>(std::stol(std::string((*it).data(), (*it).size()))); - comparison_results[left][right] = result; - } - } - - bool compare(size_t* left, size_t* right) const { - assert(left != nullptr && right != nullptr && "something is wrong with the test"); - assert(comparison_results.contains(*left) && comparison_results.at(*left).contains(*right) && - "malformed input data?"); - return comparison_results.at(*left).at(*right); - } - - size_t size() const { return comparison_results.size(); } - -private: - std::map<std::size_t, std::map<std::size_t, bool>> - comparison_results; // terrible for performance, but really convenient -}; - -class SortingFixture { -public: - explicit SortingFixture(std::string_view data) : comparison_results_(data) { - for (std::size_t i = 0; i != comparison_results_.size(); ++i) { - elements_.push_back(std::make_unique<std::size_t>(i)); - valid_ptrs_.insert(elements_.back().get()); - } - } - - std::vector<std::size_t*> create_elements() { - std::vector<std::size_t*> copy; - for (auto const& e : elements_) - copy.push_back(e.get()); - return copy; - } - - auto checked_predicate() { - return [this](size_t* left, size_t* right) { - // If the pointers passed to the comparator are not in the set of pointers we - // set up above, then we're being passed garbage values from the algorithm - // because we're reading OOB. - assert(valid_ptrs_.contains(left)); - assert(valid_ptrs_.contains(right)); - return comparison_results_.compare(left, right); - }; - } - -private: - ComparisonResults comparison_results_; - std::vector<std::unique_ptr<std::size_t>> elements_; - std::set<std::size_t*> valid_ptrs_; -}; - -#endif // TEST_LIBCXX_ALGORITHMS_ALG_SORTING_ASSERT_SORT_INVALID_COMPARATOR_INVALID_COMPARATOR_UTILITIES_H diff --git a/libcxx/test/libcxx-03/algorithms/alg.sorting/pstl.is_partitioned.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.sorting/pstl.is_partitioned.pass.cpp deleted file mode 100644 index 86647cc..0000000 --- a/libcxx/test/libcxx-03/algorithms/alg.sorting/pstl.is_partitioned.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// UNSUPPORTED: libcpp-has-no-incomplete-pstl - -// Make sure that the predicate is called exactly N times in is_partitioned - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <execution> -#include <iterator> - -int main(int, char**) { - std::size_t call_count = 0; - int a[] = {1, 2, 3, 4, 5, 6, 7, 8}; - assert(std::is_partitioned(std::execution::seq, std::begin(a), std::end(a), [&](int i) { - ++call_count; - return i < 5; - })); - assert(call_count == std::size(a)); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/callable-requirements-rvalue.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/callable-requirements-rvalue.compile.pass.cpp deleted file mode 100644 index 4a5535e..0000000 --- a/libcxx/test/libcxx-03/algorithms/callable-requirements-rvalue.compile.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <algorithm> - -// Make sure that we don't error out when passing a comparator that is lvalue callable -// but not rvalue callable to algorithms. While it is technically ill-formed for users -// to provide us such predicates, this test is useful for libc++ to ensure that we check -// predicate requirements correctly (i.e. that we check them on lvalues and not on -// rvalues). See https://github.com/llvm/llvm-project/issues/69554 for additional -// context. - -#include <algorithm> - -#include "test_macros.h" - -struct NotRvalueCallable { - bool operator()(int a, int b) const& { return a < b; } - bool operator()(int, int) && = delete; -}; - -void f() { - int a[] = {1, 2, 3, 4}; - (void)std::lower_bound(a, a + 4, 0, NotRvalueCallable{}); - (void)std::upper_bound(a, a + 4, 0, NotRvalueCallable{}); - (void)std::minmax({1, 2, 3}, NotRvalueCallable{}); - (void)std::minmax_element(a, a + 4, NotRvalueCallable{}); - (void)std::min_element(a, a + 4, NotRvalueCallable{}); - (void)std::max_element(a, a + 4, NotRvalueCallable{}); - (void)std::is_permutation(a, a + 4, a, NotRvalueCallable{}); -#if TEST_STD_VER >= 14 - (void)std::is_permutation(a, a + 4, a, a + 4, NotRvalueCallable{}); -#endif - (void)std::includes(a, a + 4, a, a + 4, NotRvalueCallable{}); - (void)std::equal_range(a, a + 4, 0, NotRvalueCallable{}); - (void)std::partial_sort_copy(a, a + 4, a, a + 4, NotRvalueCallable{}); - (void)std::search(a, a + 4, a, a + 4, NotRvalueCallable{}); - (void)std::search_n(a, a + 4, 4, 0, NotRvalueCallable{}); -} diff --git a/libcxx/test/libcxx-03/algorithms/callable-requirements.verify.cpp b/libcxx/test/libcxx-03/algorithms/callable-requirements.verify.cpp deleted file mode 100644 index 7555d98..0000000 --- a/libcxx/test/libcxx-03/algorithms/callable-requirements.verify.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Ignore spurious errors after the initial static_assert failure. -// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error - -// <algorithm> - -// Check that calling a classic STL algorithm with various non-callable comparators is diagnosed. - -#include <algorithm> - -#include "test_macros.h" - -struct NotCallable { - bool compare(int a, int b) const { return a < b; } -}; - -struct NotMutableCallable { - bool operator()(int a, int b) = delete; - bool operator()(int a, int b) const { return a < b; } -}; - -void f() { - int a[] = {1, 2, 3, 4}; - { - (void)std::lower_bound(a, a + 4, 0, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::upper_bound(a, a + 4, 0, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::minmax({1, 2, 3}, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::minmax_element(a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::min_element(a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::max_element(a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::is_permutation(a, a + 4, a, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - -#if TEST_STD_VER >= 14 - (void)std::is_permutation(a, a + 4, a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} -#endif - - (void)std::includes(a, a + 4, a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::equal_range(a, a + 4, 0, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::partial_sort_copy(a, a + 4, a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::search(a, a + 4, a, a + 4, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::search_n(a, a + 4, 4, 0, &NotCallable::compare); - // expected-error@*:* {{The comparator has to be callable}} - } - - { - (void)std::lower_bound(a, a + 4, 0, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::upper_bound(a, a + 4, 0, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::minmax({1, 2, 3}, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::minmax_element(a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::min_element(a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::max_element(a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::is_permutation(a, a + 4, a, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - -#if TEST_STD_VER >= 14 - (void)std::is_permutation(a, a + 4, a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} -#endif - - (void)std::includes(a, a + 4, a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::equal_range(a, a + 4, 0, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::partial_sort_copy(a, a + 4, a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::search(a, a + 4, a, a + 4, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - - (void)std::search_n(a, a + 4, 4, 0, NotMutableCallable{}); - // expected-error@*:* {{The comparator has to be callable}} - } -} diff --git a/libcxx/test/libcxx-03/algorithms/cpp17_iterator_concepts.verify.cpp b/libcxx/test/libcxx-03/algorithms/cpp17_iterator_concepts.verify.cpp deleted file mode 100644 index c4462b2..0000000 --- a/libcxx/test/libcxx-03/algorithms/cpp17_iterator_concepts.verify.cpp +++ /dev/null @@ -1,425 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that __cpp17_*_iterator catch bad iterators - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <__iterator/cpp17_iterator_concepts.h> -#include <__iterator/iterator_traits.h> -#include <compare> -#include <cstddef> - -struct missing_deref { - using difference_type = std::ptrdiff_t; - using iterator_category = std::input_iterator_tag; - using value_type = int; - using reference = int&; - - missing_deref& operator++(); -}; - -struct missing_preincrement { - using difference_type = std::ptrdiff_t; - using iterator_category = std::input_iterator_tag; - using value_type = int; - using reference = int&; - - int& operator*(); -}; - -template <class Derived> -struct valid_iterator { - using difference_type = std::ptrdiff_t; - using iterator_category = std::input_iterator_tag; - using value_type = int; - using reference = int&; - - int& operator*() const; - Derived& operator++(); - - struct Proxy { - int operator*(); - }; - - Proxy operator++(int); -}; - -struct not_move_constructible : valid_iterator<not_move_constructible> { - not_move_constructible(const not_move_constructible&) = default; - not_move_constructible(not_move_constructible&&) = delete; - not_move_constructible& operator=(not_move_constructible&&) = default; - not_move_constructible& operator=(const not_move_constructible&) = default; -}; - -struct not_copy_constructible : valid_iterator<not_copy_constructible> { - not_copy_constructible(const not_copy_constructible&) = delete; - not_copy_constructible(not_copy_constructible&&) = default; - not_copy_constructible& operator=(not_copy_constructible&&) = default; - not_copy_constructible& operator=(const not_copy_constructible&) = default; -}; - -struct not_move_assignable : valid_iterator<not_move_assignable> { - not_move_assignable(const not_move_assignable&) = default; - not_move_assignable(not_move_assignable&&) = default; - not_move_assignable& operator=(not_move_assignable&&) = delete; - not_move_assignable& operator=(const not_move_assignable&) = default; -}; - -struct not_copy_assignable : valid_iterator<not_copy_assignable> { - not_copy_assignable(const not_copy_assignable&) = default; - not_copy_assignable(not_copy_assignable&&) = default; - not_copy_assignable& operator=(not_copy_assignable&&) = default; - not_copy_assignable& operator=(const not_copy_assignable&) = delete; -}; - -struct diff_t_not_signed : valid_iterator<diff_t_not_signed> { - using difference_type = unsigned; -}; - -void check_iterator_requirements() { - static_assert(std::__cpp17_iterator<missing_deref>); // expected-error {{static assertion failed}} - // expected-note@*:* {{indirection requires pointer operand}} - - static_assert(std::__cpp17_iterator<missing_preincrement>); // expected-error {{static assertion failed}} - // expected-note@*:* {{cannot increment value of type 'missing_preincrement'}} - - static_assert(std::__cpp17_iterator<not_move_constructible>); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'not_move_constructible' does not satisfy '__cpp17_move_constructible'}} - - static_assert(std::__cpp17_iterator<not_copy_constructible>); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'not_copy_constructible' does not satisfy '__cpp17_copy_constructible'}} - - static_assert(std::__cpp17_iterator<not_move_assignable>); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'not_move_assignable' does not satisfy '__cpp17_copy_assignable'}} - - static_assert(std::__cpp17_iterator<not_copy_assignable>); // expected-error {{static assertion failed}} - // expectted-note@*:* {{because 'not_copy_assignable' does not satisfy '__cpp17_copy_assignable'}} - - static_assert(std::__cpp17_iterator<diff_t_not_signed>); // expected-error {{static assertion failed}} - // expectted-note@*:* {{'is_signed_v<__iter_diff_t<diff_t_not_signed> >' evaluated to false}} -} - -struct not_equality_comparable : valid_iterator<not_equality_comparable> {}; -bool operator==(not_equality_comparable, not_equality_comparable) = delete; -bool operator!=(not_equality_comparable, not_equality_comparable); - -struct not_unequality_comparable : valid_iterator<not_unequality_comparable> {}; -bool operator==(not_unequality_comparable, not_unequality_comparable); -bool operator!=(not_unequality_comparable, not_unequality_comparable) = delete; - -void check_input_iterator_requirements() { - // clang-format off - _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(not_equality_comparable, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{'__lhs == __rhs' would be invalid: overload resolution selected deleted operator '=='}} - - _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(not_unequality_comparable, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{'__lhs != __rhs' would be invalid: overload resolution selected deleted operator '!='}} - // clang-format on -} - -template <class Derived> -struct valid_forward_iterator : valid_iterator<Derived> { - Derived& operator++(); - Derived operator++(int); - - friend bool operator==(Derived, Derived); -}; - -struct not_default_constructible : valid_forward_iterator<not_default_constructible> { - not_default_constructible() = delete; -}; - -struct postincrement_not_ref : valid_iterator<postincrement_not_ref> {}; -bool operator==(postincrement_not_ref, postincrement_not_ref); - -void check_forward_iterator_requirements() { - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(not_default_constructible, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'not_default_constructible' does not satisfy '__cpp17_default_constructible'}} - _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(postincrement_not_ref, ""); // expected-error {{static assertion failed}} -#ifndef _AIX - // expected-note-re@*:* {{because type constraint 'convertible_to<{{(valid_iterator<postincrement_not_ref>::)?}}Proxy, const postincrement_not_ref &>' was not satisfied}} -#endif -} - -struct missing_predecrement : valid_forward_iterator<missing_predecrement> { - missing_deref operator--(int); -}; - -struct missing_postdecrement : valid_forward_iterator<missing_postdecrement> { - missing_postdecrement& operator--(); -}; - -struct not_returning_iter_reference : valid_forward_iterator<not_returning_iter_reference> { - struct Proxy { - operator const not_returning_iter_reference&(); - - int operator*(); - }; - - not_returning_iter_reference& operator--(); - Proxy operator--(int); -}; - -void check_bidirectional_iterator_requirements() { - // clang-format off - _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(missing_predecrement, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{cannot decrement value of type 'missing_predecrement'}} - _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(missing_postdecrement, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{cannot decrement value of type 'missing_postdecrement'}} - _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(not_returning_iter_reference, ""); // expected-error {{static assertion failed}} - // expected-note-re@*:* {{because type constraint 'same_as<int, __iter_reference<not_returning_iter_reference>{{ ?}}>' was not satisfied}} - // clang-format on -} - -template <class Derived> -struct valid_random_access_iterator : valid_forward_iterator<Derived> { - using difference_type = typename valid_forward_iterator<Derived>::difference_type; - - Derived& operator--(); - Derived operator--(int); - - Derived& operator+=(difference_type); - Derived& operator-=(difference_type); - - friend Derived operator+(valid_random_access_iterator, difference_type); - friend Derived operator+(difference_type, valid_random_access_iterator); - friend Derived operator-(valid_random_access_iterator, difference_type); - friend Derived operator-(difference_type, valid_random_access_iterator); - friend difference_type operator-(valid_random_access_iterator, valid_random_access_iterator); - - int& operator[](difference_type) const; - - friend std::strong_ordering operator<=>(Derived, Derived); -}; - -struct missing_plus_equals : valid_random_access_iterator<missing_plus_equals> { - void operator+=(difference_type) = delete; -}; - -struct missing_minus_equals : valid_random_access_iterator<missing_minus_equals> { - void operator-=(difference_type) = delete; -}; - -struct missing_plus_iter_diff : valid_random_access_iterator<missing_plus_iter_diff> { - void operator+(difference_type) = delete; -}; - -struct missing_plus_diff_iter : valid_random_access_iterator<missing_plus_diff_iter> { - friend missing_plus_diff_iter operator+(difference_type, missing_plus_diff_iter) = delete; -}; - -struct missing_plus_iter_diff_const_mut : valid_random_access_iterator<missing_plus_iter_diff_const_mut> { - friend missing_plus_iter_diff_const_mut operator+(missing_plus_iter_diff_const_mut&, difference_type); - friend missing_plus_iter_diff_const_mut operator+(const missing_plus_iter_diff_const_mut&, difference_type) = delete; -}; - -struct missing_plus_iter_diff_mut_const : valid_random_access_iterator<missing_plus_iter_diff_mut_const> { - friend missing_plus_iter_diff_mut_const operator+(missing_plus_iter_diff_mut_const, difference_type); - friend missing_plus_iter_diff_mut_const operator+(difference_type, missing_plus_iter_diff_mut_const&); - friend missing_plus_iter_diff_mut_const operator+(difference_type, const missing_plus_iter_diff_mut_const&) = delete; -}; - -struct missing_minus_iter_diff_const : valid_random_access_iterator<missing_minus_iter_diff_const> { - friend missing_minus_iter_diff_const operator-(missing_minus_iter_diff_const&, difference_type); - friend missing_minus_iter_diff_const operator-(const missing_minus_iter_diff_const&, difference_type) = delete; -}; - -struct missing_minus_iter_iter : valid_random_access_iterator<missing_minus_iter_iter> { - friend missing_minus_iter_iter operator-(missing_minus_iter_iter, missing_minus_iter_iter) = delete; -}; - -struct missing_minus_const_iter_iter : valid_random_access_iterator<missing_minus_const_iter_iter> { - friend difference_type operator-(missing_minus_const_iter_iter&, missing_minus_const_iter_iter); - friend difference_type operator-(const missing_minus_const_iter_iter&, missing_minus_const_iter_iter) = delete; -}; - -struct missing_minus_iter_const_iter : valid_random_access_iterator<missing_minus_iter_const_iter> { - friend difference_type operator-(missing_minus_iter_const_iter, missing_minus_iter_const_iter&); - friend difference_type operator-(missing_minus_iter_const_iter, const missing_minus_iter_const_iter&) = delete; -}; - -struct missing_minus_const_iter_const_iter : valid_random_access_iterator<missing_minus_const_iter_const_iter> { - friend difference_type operator-(missing_minus_const_iter_const_iter&, missing_minus_const_iter_const_iter&); - friend difference_type operator-(const missing_minus_const_iter_const_iter&, missing_minus_const_iter_const_iter&); - friend difference_type operator-(missing_minus_const_iter_const_iter&, const missing_minus_const_iter_const_iter&); - friend difference_type - operator-(const missing_minus_const_iter_const_iter&, const missing_minus_const_iter_const_iter&) = delete; -}; - -struct missing_subscript_operator : valid_random_access_iterator<missing_subscript_operator> { - int& operator[](difference_type) = delete; -}; - -struct missing_const_subscript_operator : valid_random_access_iterator<missing_const_subscript_operator> { - int& operator[](difference_type); - int& operator[](difference_type) const = delete; -}; - -struct missing_less : valid_random_access_iterator<missing_less> { - friend bool operator<(missing_less, missing_less) = delete; -}; - -struct missing_const_mut_less : valid_random_access_iterator<missing_const_mut_less> { - friend bool operator<(missing_const_mut_less&, missing_const_mut_less&); - friend bool operator<(missing_const_mut_less&, const missing_const_mut_less&); - friend bool operator<(const missing_const_mut_less&, missing_const_mut_less&) = delete; - friend bool operator<(const missing_const_mut_less&, const missing_const_mut_less&); -}; - -struct missing_mut_const_less : valid_random_access_iterator<missing_mut_const_less> { - friend bool operator<(missing_mut_const_less&, missing_mut_const_less&); - friend bool operator<(missing_mut_const_less&, const missing_mut_const_less&) = delete; - friend bool operator<(const missing_mut_const_less&, missing_mut_const_less&); - friend bool operator<(const missing_mut_const_less&, const missing_mut_const_less&); -}; - -struct missing_const_const_less : valid_random_access_iterator<missing_const_const_less> { - friend bool operator<(missing_const_const_less&, missing_const_const_less&); - friend bool operator<(missing_const_const_less&, const missing_const_const_less&); - friend bool operator<(const missing_const_const_less&, missing_const_const_less&); - friend bool operator<(const missing_const_const_less&, const missing_const_const_less&) = delete; -}; - -struct missing_greater : valid_random_access_iterator<missing_greater> { - friend bool operator>(missing_greater, missing_greater) = delete; -}; - -struct missing_const_mut_greater : valid_random_access_iterator<missing_const_mut_greater> { - friend bool operator>(missing_const_mut_greater&, missing_const_mut_greater&); - friend bool operator>(missing_const_mut_greater&, const missing_const_mut_greater&); - friend bool operator>(const missing_const_mut_greater&, missing_const_mut_greater&) = delete; - friend bool operator>(const missing_const_mut_greater&, const missing_const_mut_greater&); -}; - -struct missing_mut_const_greater : valid_random_access_iterator<missing_mut_const_greater> { - friend bool operator>(missing_mut_const_greater&, missing_mut_const_greater&); - friend bool operator>(missing_mut_const_greater&, const missing_mut_const_greater&) = delete; - friend bool operator>(const missing_mut_const_greater&, missing_mut_const_greater&); - friend bool operator>(const missing_mut_const_greater&, const missing_mut_const_greater&); -}; - -struct missing_const_const_greater : valid_random_access_iterator<missing_const_const_greater> { - friend bool operator>(missing_const_const_greater&, missing_const_const_greater&); - friend bool operator>(missing_const_const_greater&, const missing_const_const_greater&); - friend bool operator>(const missing_const_const_greater&, missing_const_const_greater&); - friend bool operator>(const missing_const_const_greater&, const missing_const_const_greater&) = delete; -}; - -struct missing_less_eq : valid_random_access_iterator<missing_less_eq> { - friend bool operator<=(missing_less_eq, missing_less_eq) = delete; -}; - -struct missing_const_mut_less_eq : valid_random_access_iterator<missing_const_mut_less_eq> { - friend bool operator<=(missing_const_mut_less_eq&, missing_const_mut_less_eq&); - friend bool operator<=(missing_const_mut_less_eq&, const missing_const_mut_less_eq&); - friend bool operator<=(const missing_const_mut_less_eq&, missing_const_mut_less_eq&) = delete; - friend bool operator<=(const missing_const_mut_less_eq&, const missing_const_mut_less_eq&); -}; - -struct missing_mut_const_less_eq : valid_random_access_iterator<missing_mut_const_less_eq> { - friend bool operator<=(missing_mut_const_less_eq&, missing_mut_const_less_eq&); - friend bool operator<=(missing_mut_const_less_eq&, const missing_mut_const_less_eq&) = delete; - friend bool operator<=(const missing_mut_const_less_eq&, missing_mut_const_less_eq&); - friend bool operator<=(const missing_mut_const_less_eq&, const missing_mut_const_less_eq&); -}; - -struct missing_const_const_less_eq : valid_random_access_iterator<missing_const_const_less_eq> { - friend bool operator<=(missing_const_const_less_eq&, missing_const_const_less_eq&); - friend bool operator<=(missing_const_const_less_eq&, const missing_const_const_less_eq&); - friend bool operator<=(const missing_const_const_less_eq&, missing_const_const_less_eq&); - friend bool operator<=(const missing_const_const_less_eq&, const missing_const_const_less_eq&) = delete; -}; - -struct missing_greater_eq : valid_random_access_iterator<missing_greater_eq> { - friend bool operator>=(missing_greater_eq, missing_greater_eq) = delete; -}; - -struct missing_const_mut_greater_eq : valid_random_access_iterator<missing_const_mut_greater_eq> { - friend bool operator>=(missing_const_mut_greater_eq&, missing_const_mut_greater_eq&); - friend bool operator>=(missing_const_mut_greater_eq&, const missing_const_mut_greater_eq&); - friend bool operator>=(const missing_const_mut_greater_eq&, missing_const_mut_greater_eq&) = delete; - friend bool operator>=(const missing_const_mut_greater_eq&, const missing_const_mut_greater_eq&); -}; - -struct missing_mut_const_greater_eq : valid_random_access_iterator<missing_mut_const_greater_eq> { - friend bool operator>=(missing_mut_const_greater_eq&, missing_mut_const_greater_eq&); - friend bool operator>=(missing_mut_const_greater_eq&, const missing_mut_const_greater_eq&) = delete; - friend bool operator>=(const missing_mut_const_greater_eq&, missing_mut_const_greater_eq&); - friend bool operator>=(const missing_mut_const_greater_eq&, const missing_mut_const_greater_eq&); -}; - -struct missing_const_const_greater_eq : valid_random_access_iterator<missing_const_const_greater_eq> { - friend bool operator>=(missing_const_const_greater_eq&, missing_const_const_greater_eq&); - friend bool operator>=(missing_const_const_greater_eq&, const missing_const_const_greater_eq&); - friend bool operator>=(const missing_const_const_greater_eq&, missing_const_const_greater_eq&); - friend bool operator>=(const missing_const_const_greater_eq&, const missing_const_const_greater_eq&) = delete; -}; - -void check_random_access_iterator() { - // clang-format off - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_equals, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter += __n' would be invalid: overload resolution selected deleted operator '+='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_equals, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter -= __n' would be invalid: overload resolution selected deleted operator '-='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter + __n' would be invalid: overload resolution selected deleted operator '+'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_diff_iter, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__n + __iter' would be invalid: overload resolution selected deleted operator '+'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff_const_mut, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) + __n' would be invalid: overload resolution selected deleted operator '+'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_plus_iter_diff_mut_const, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__n + std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '+'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_diff_const, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) - __n' would be invalid: overload resolution selected deleted operator '-'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_iter, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter - __iter' would be invalid: overload resolution selected deleted operator '-'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_const_iter_iter, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) - __iter' would be invalid: overload resolution selected deleted operator '-'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_iter_const_iter, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter - std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '-'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_minus_const_iter_const_iter, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) - std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '-'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_subscript_operator, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter[__n]' would be invalid: overload resolution selected deleted operator '[]'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_subscript_operator, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter)[__n]' would be invalid: overload resolution selected deleted operator '[]'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_less, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter < __iter' would be invalid: overload resolution selected deleted operator '<'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_less, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) < __iter' would be invalid: overload resolution selected deleted operator '<'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_less, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter < std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_less, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) < std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_greater, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter > __iter' would be invalid: overload resolution selected deleted operator '>'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_greater, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) > __iter' would be invalid: overload resolution selected deleted operator '>'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_greater, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter > std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_greater, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) > std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>'}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_less_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter <= __iter' would be invalid: overload resolution selected deleted operator '<='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_less_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) <= __iter' would be invalid: overload resolution selected deleted operator '<='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_less_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter <= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_less_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) <= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '<='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_greater_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter >= __iter' would be invalid: overload resolution selected deleted operator '>='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_mut_greater_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) >= __iter' would be invalid: overload resolution selected deleted operator '>='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_mut_const_greater_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because '__iter >= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>='}} - _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(missing_const_const_greater_eq, ""); // expected-error {{static assertion failed}} - // expected-note@*:* {{because 'std::as_const(__iter) >= std::as_const(__iter)' would be invalid: overload resolution selected deleted operator '>='}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/algorithms/debug_less.inconsistent.pass.cpp b/libcxx/test/libcxx-03/algorithms/debug_less.inconsistent.pass.cpp deleted file mode 100644 index 701edd1..0000000 --- a/libcxx/test/libcxx-03/algorithms/debug_less.inconsistent.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// template <class _Compare> struct __debug_less - -// Make sure __debug_less asserts when the comparator is not consistent. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode=debug -// UNSUPPORTED: c++03 - -#include <algorithm> -#include <iterator> - -#include "check_assertion.h" - -template <int ID> -struct MyType { - int value; - explicit MyType(int xvalue = 0) : value(xvalue) {} -}; - -template <int ID1, int ID2> -bool operator<(MyType<ID1> const& LHS, MyType<ID2> const& RHS) { - return LHS.value < RHS.value; -} - -template <class ValueType> -struct BadComparator { - bool operator()(ValueType const&, ValueType const&) const { - return true; - } -}; - -int main(int, char**) { - typedef MyType<0> MT0; - MT0 one(1); - MT0 two(2); - - BadComparator<MT0> c; - std::__debug_less<BadComparator<MT0>> d(c); - - TEST_LIBCPP_ASSERT_FAILURE(d(one, two), "Comparator does not induce a strict weak ordering"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/debug_less.pass.cpp b/libcxx/test/libcxx-03/algorithms/debug_less.pass.cpp deleted file mode 100644 index 4889f94..0000000 --- a/libcxx/test/libcxx-03/algorithms/debug_less.pass.cpp +++ /dev/null @@ -1,260 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// template <class _Compare> struct __debug_less - -// __debug_less checks that a comparator actually provides a strict-weak ordering. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode=debug -// UNSUPPORTED: c++03 - -#include <algorithm> -#include <cassert> -#include <functional> -#include <iterator> - -#include "test_macros.h" -#include "check_assertion.h" - -template <int ID> -struct MyType { - int value; - explicit MyType(int xvalue = 0) : value(xvalue) {} -}; - -template <int ID1, int ID2> -bool operator<(MyType<ID1> const& LHS, MyType<ID2> const& RHS) { - return LHS.value < RHS.value; -} - -struct CompareBase { - static int called; - static void reset() { - called = 0; - } -}; - -int CompareBase::called = 0; - -template <class ValueType> -struct GoodComparator : public CompareBase { - bool operator()(ValueType const& lhs, ValueType const& rhs) const { - ++CompareBase::called; - return lhs < rhs; - } -}; - -template <class T1, class T2> -struct TwoWayHomoComparator : public CompareBase { - bool operator()(T1 const& lhs, T2 const& rhs) const { - ++CompareBase::called; - return lhs < rhs; - } - - bool operator()(T2 const& lhs, T1 const& rhs) const { - ++CompareBase::called; - return lhs < rhs; - } -}; - -template <class T1, class T2> -struct OneWayHomoComparator : public CompareBase { - bool operator()(T1 const& lhs, T2 const& rhs) const { - ++CompareBase::called; - return lhs < rhs; - } -}; - -using std::__debug_less; - -typedef MyType<0> MT0; -typedef MyType<1> MT1; - -void test_passing() { - int& called = CompareBase::called; - called = 0; - MT0 one(1); - MT0 two(2); - MT1 three(3); - MT1 four(4); - - { - typedef GoodComparator<MT0> C; - typedef __debug_less<C> D; - - C c; - D d(c); - - assert(d(one, two) == true); - assert(called == 2); - called = 0; - - assert(d(one, one) == false); - assert(called == 1); - called = 0; - - assert(d(two, one) == false); - assert(called == 1); - called = 0; - } - { - typedef TwoWayHomoComparator<MT0, MT1> C; - typedef __debug_less<C> D; - C c; - D d(c); - - assert(d(one, three) == true); - assert(called == 2); - called = 0; - - assert(d(three, one) == false); - assert(called == 1); - called = 0; - } - { - typedef OneWayHomoComparator<MT0, MT1> C; - typedef __debug_less<C> D; - C c; - D d(c); - - assert(d(one, three) == true); - assert(called == 1); - called = 0; - } -} - -template <int> -struct Tag { - explicit Tag(int v) : value(v) {} - int value; -}; - -template <class = void> -struct FooImp { - explicit FooImp(int x) : x_(x) {} - int x_; -}; - -template <class T> -inline bool operator<(FooImp<T> const& x, Tag<0> y) { - return x.x_ < y.value; -} - -template <class T> -inline bool operator<(Tag<0>, FooImp<T> const&) { - static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated"); - return false; -} - -template <class T> -inline bool operator<(Tag<1> x, FooImp<T> const& y) { - return x.value < y.x_; -} - -template <class T> -inline bool operator<(FooImp<T> const&, Tag<1>) { - static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated"); - return false; -} - -typedef FooImp<> Foo; - -// Test that we don't attempt to call the comparator with the arguments reversed -// for upper_bound and lower_bound since the comparator or type is not required -// to support it, nor does it require the range to have a strict weak ordering. -// See llvm.org/PR39458 -void test_upper_and_lower_bound() { - Foo table[] = {Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)}; - { - Foo* iter = std::lower_bound(std::begin(table), std::end(table), Tag<0>(3)); - assert(iter == (table + 2)); - } - { - Foo* iter = std::upper_bound(std::begin(table), std::end(table), Tag<1>(3)); - assert(iter == (table + 3)); - } -} - -struct NonConstArgCmp { - bool operator()(int& x, int &y) const { - return x < y; - } -}; - -void test_non_const_arg_cmp() { - { - NonConstArgCmp cmp; - __debug_less<NonConstArgCmp> dcmp(cmp); - int x = 0, y = 1; - assert(dcmp(x, y)); - assert(!dcmp(y, x)); - } - { - NonConstArgCmp cmp; - int arr[] = {5, 4, 3, 2, 1}; - std::sort(std::begin(arr), std::end(arr), cmp); - assert(std::is_sorted(std::begin(arr), std::end(arr))); - } -} - -struct ValueIterator { - typedef std::input_iterator_tag iterator_category; - typedef std::size_t value_type; - typedef std::ptrdiff_t difference_type; - typedef std::size_t reference; - typedef std::size_t* pointer; - - ValueIterator() { } - - reference operator*() { return 0; } - ValueIterator& operator++() { return *this; } - - friend bool operator==(ValueIterator, ValueIterator) { return true; } - friend bool operator!=(ValueIterator, ValueIterator) { return false; } -}; - -void test_value_iterator() { - // Ensure no build failures when iterators return values, not references. - assert(0 == std::lexicographical_compare(ValueIterator(), ValueIterator(), - ValueIterator(), ValueIterator())); -} - -void test_value_categories() { - std::less<int> l; - std::__debug_less<std::less<int> > dl(l); - int lvalue = 42; - const int const_lvalue = 101; - - assert(dl(lvalue, const_lvalue)); - assert(dl(/*rvalue*/1, lvalue)); - assert(dl(static_cast<int&&>(1), static_cast<const int&&>(2))); -} - -#if TEST_STD_VER > 11 -constexpr bool test_constexpr() { - std::less<> cmp{}; - __debug_less<std::less<> > dcmp(cmp); - assert(dcmp(1, 2)); - assert(!dcmp(1, 1)); - return true; -} -#endif - -int main(int, char**) { - test_passing(); - test_upper_and_lower_bound(); - test_non_const_arg_cmp(); - test_value_iterator(); - test_value_categories(); -#if TEST_STD_VER > 11 - static_assert(test_constexpr(), ""); -#endif - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/debug_three_way_comp.inconsistent.pass.cpp b/libcxx/test/libcxx-03/algorithms/debug_three_way_comp.inconsistent.pass.cpp deleted file mode 100644 index b9bb1c9..0000000 --- a/libcxx/test/libcxx-03/algorithms/debug_three_way_comp.inconsistent.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// template <class _Comp> struct __debug_three_way_comp - -// Make sure __debug_three_way_comp asserts when the comparator is not consistent. - -// REQUIRES: libcpp-hardening-mode=debug -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <algorithm> -#include <iterator> - -#include "check_assertion.h" - -struct AlwaysLess { - std::strong_ordering operator()(int, int) const { return std::strong_ordering::less; } -}; - -struct AlwaysGreater { - std::strong_ordering operator()(int, int) const { return std::strong_ordering::greater; } -}; - -struct InconsistentEquals { - std::strong_ordering operator()(int a, int) const { - if (a == 0) - return std::strong_ordering::equal; - return std::strong_ordering::greater; - } -}; - -int main(int, char**) { - int zero = 0; - int one = 1; - - AlwaysLess alwaysLess; - std::__debug_three_way_comp<AlwaysLess> debugAlwaysLess(alwaysLess); - TEST_LIBCPP_ASSERT_FAILURE(debugAlwaysLess(zero, one), "Comparator does not induce a strict weak ordering"); - - AlwaysGreater alwaysGreater; - std::__debug_three_way_comp<AlwaysGreater> debugAlwaysGreater(alwaysGreater); - TEST_LIBCPP_ASSERT_FAILURE(debugAlwaysGreater(zero, one), "Comparator does not induce a strict weak ordering"); - - InconsistentEquals inconsistentEquals; - std::__debug_three_way_comp<InconsistentEquals> debugInconsistentEquals(inconsistentEquals); - TEST_LIBCPP_ASSERT_FAILURE(debugInconsistentEquals(zero, one), "Comparator does not induce a strict weak ordering"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/lifetimebound.verify.cpp b/libcxx/test/libcxx-03/algorithms/lifetimebound.verify.cpp deleted file mode 100644 index 6bb1a4c..0000000 --- a/libcxx/test/libcxx-03/algorithms/lifetimebound.verify.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-pessimizing-move -Wno-unused-variable - -#include <algorithm> - -#include "test_macros.h" - -struct Comp { - template <class T, class U> - bool operator()(T, U) { - return false; - } -}; - -void func() { - int i = 0; - { - auto&& v1 = std::min(0, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::min(i, 0); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::min(0, i, Comp{}); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::min(i, 0, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - } - { - auto&& v1 = std::max(0, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::max(i, 0); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::max(0, i, Comp{}); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::max(i, 0, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - } - { - auto&& v1 = std::minmax(0, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::minmax(i, 0); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::minmax(0, i, Comp{}); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::minmax(i, 0, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - auto v5 = std::minmax(0, i); // expected-warning {{temporary whose address is used as value of local variable 'v5' will be destroyed at the end of the full-expression}} - auto v6 = std::minmax(i, 0); // expected-warning {{temporary whose address is used as value of local variable 'v6' will be destroyed at the end of the full-expression}} - auto v7 = std::minmax(0, i, Comp{}); // expected-warning {{temporary whose address is used as value of local variable 'v7' will be destroyed at the end of the full-expression}} - auto v8 = std::minmax(i, 0, Comp{}); // expected-warning {{temporary whose address is used as value of local variable 'v8' will be destroyed at the end of the full-expression}} - } -#if TEST_STD_VER >= 17 - { - auto&& v1 = std::clamp(1, i, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::clamp(i, 1, i); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::clamp(i, i, 1); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::clamp(1, i, i, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - auto&& v5 = std::clamp(i, 1, i, Comp{}); // expected-warning {{temporary bound to local reference 'v5' will be destroyed at the end of the full-expression}} - auto&& v6 = std::clamp(i, i, 1, Comp{}); // expected-warning {{temporary bound to local reference 'v6' will be destroyed at the end of the full-expression}} - } -#endif -#if TEST_STD_VER >= 20 - { - auto&& v1 = std::ranges::min(0, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::ranges::min(i, 0); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::ranges::min(0, i, Comp{}); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::ranges::min(i, 0, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - } - { - auto&& v1 = std::ranges::max(0, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::ranges::max(i, 0); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::ranges::max(0, i, Comp{}); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::ranges::max(i, 0, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - } - { - auto&& v1 = std::ranges::minmax(0, i); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::ranges::minmax(i, 0); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::ranges::minmax(0, i, Comp{}); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::ranges::minmax(i, 0, Comp{}); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} - auto v5 = std::ranges::minmax(0, i); // expected-warning {{temporary whose address is used as value of local variable 'v5' will be destroyed at the end of the full-expression}} - auto v6 = std::ranges::minmax(i, 0); // expected-warning {{temporary whose address is used as value of local variable 'v6' will be destroyed at the end of the full-expression}} - auto v7 = std::ranges::minmax(0, i, Comp{}); // expected-warning {{temporary whose address is used as value of local variable 'v7' will be destroyed at the end of the full-expression}} - auto v8 = std::ranges::minmax(i, 0, Comp{}); // expected-warning {{temporary whose address is used as value of local variable 'v8' will be destroyed at the end of the full-expression}} - } -#endif // TEST_STD_VER >= 20 -} diff --git a/libcxx/test/libcxx-03/algorithms/no_specializations.verify.cpp b/libcxx/test/libcxx-03/algorithms/no_specializations.verify.cpp deleted file mode 100644 index 5b24752..0000000 --- a/libcxx/test/libcxx-03/algorithms/no_specializations.verify.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// UNSUPPORTED: libcpp-has-no-incomplete-pstl - -// Check that user-specializations are diagnosed -// See [execpol.type]/3 - -#include <execution> - -#if !__has_warning("-Winvalid-specializations") -// expected-no-diagnostics -#else -struct S {}; - -template <> -struct std::is_execution_policy<S>; // expected-error {{cannot be specialized}} - -template <> -constexpr bool std::is_execution_policy_v<S> = false; // expected-error {{cannot be specialized}} -#endif diff --git a/libcxx/test/libcxx-03/algorithms/nth_element_stability.pass.cpp b/libcxx/test/libcxx-03/algorithms/nth_element_stability.pass.cpp deleted file mode 100644 index 7124e54..0000000 --- a/libcxx/test/libcxx-03/algorithms/nth_element_stability.pass.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// Test std::nth_element stability randomization - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY - -#include <algorithm> -#include <array> -#include <cassert> -#include <functional> -#include <iterator> -#include <vector> - -#include "test_macros.h" - -struct MyType { - int value = 0; - constexpr bool operator<(const MyType& other) const { return value < other.value; } -}; - -std::vector<MyType> deterministic() { - static constexpr int kSize = 100; - std::vector<MyType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = (i % 2 ? i : kSize / 2 + i); - } - std::__nth_element<std::_ClassicAlgPolicy>(v.begin(), v.begin() + kSize / 2, v.end(), std::less<MyType>()); - return v; -} - -void test_randomization() { - static constexpr int kSize = 100; - std::vector<MyType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = (i % 2 ? i : kSize / 2 + i); - } - auto deterministic_v = deterministic(); - std::nth_element(v.begin(), v.begin() + kSize / 2, v.end()); - bool all_equal = true; - for (int i = 0; i < kSize; ++i) { - if (v[i].value != deterministic_v[i].value) { - all_equal = false; - } - } - assert(!all_equal); -} - -void test_same() { - static constexpr int kSize = 100; - std::vector<MyType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = (i % 2 ? i : kSize / 2 + i); - } - auto snapshot_v = v; - auto snapshot_custom_v = v; - std::nth_element(v.begin(), v.begin() + kSize / 2, v.end()); - std::nth_element(snapshot_v.begin(), snapshot_v.begin() + kSize / 2, snapshot_v.end()); - std::nth_element(snapshot_custom_v.begin(), snapshot_custom_v.begin() + kSize / 2, snapshot_custom_v.end(), std::less<MyType>()); - bool all_equal = true; - for (int i = 0; i < kSize; ++i) { - if (v[i].value != snapshot_v[i].value || v[i].value != snapshot_custom_v[i].value) { - all_equal = false; - } - if (i < kSize / 2) { - assert(v[i].value <= v[kSize / 2].value); - } - } - assert(all_equal); -} - -#if TEST_STD_VER > 17 -constexpr bool test_constexpr() { - std::array<MyType, 10> v; - for (int i = 9; i >= 0; --i) { - v[9 - i].value = i; - } - std::nth_element(v.begin(), v.begin() + 5, v.end()); - return std::is_partitioned(v.begin(), v.end(), [&](const MyType& m) { return m.value <= v[5].value; }); -} -#endif - -int main(int, char**) { - test_randomization(); - test_same(); -#if TEST_STD_VER > 17 - static_assert(test_constexpr(), ""); -#endif - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/partial_sort_stability.pass.cpp b/libcxx/test/libcxx-03/algorithms/partial_sort_stability.pass.cpp deleted file mode 100644 index 3f9a5a0..0000000 --- a/libcxx/test/libcxx-03/algorithms/partial_sort_stability.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// Test std::partial_sort stability randomization - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY - -#include <algorithm> -#include <array> -#include <cassert> -#include <functional> -#include <iterator> -#include <vector> - -#include "test_macros.h" - -struct MyType { - int value = 0; - constexpr bool operator<(const MyType& other) const { return value < other.value; } -}; - -std::vector<MyType> deterministic() { - static constexpr int kSize = 100; - std::vector<MyType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = (i % 2 ? 1 : kSize / 2 + i); - } - auto comp = std::less<MyType>(); - std::__partial_sort_impl<std::_ClassicAlgPolicy>(v.begin(), v.begin() + kSize / 2, v.end(), comp); - return v; -} - -void test_randomization() { - static constexpr int kSize = 100; - std::vector<MyType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = (i % 2 ? 1 : kSize / 2 + i); - } - auto deterministic_v = deterministic(); - std::partial_sort(v.begin(), v.begin() + kSize / 2, v.end()); - bool all_equal = true; - for (int i = 0; i < kSize; ++i) { - if (v[i].value != deterministic_v[i].value) { - all_equal = false; - } - } - assert(!all_equal); -} - -void test_same() { - static constexpr int kSize = 100; - std::vector<MyType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = (i % 2 ? 1 : kSize / 2 + i); - } - auto snapshot_v = v; - auto snapshot_custom_v = v; - std::partial_sort(v.begin(), v.begin() + kSize / 2, v.end()); - std::partial_sort(snapshot_v.begin(), snapshot_v.begin() + kSize / 2, snapshot_v.end()); - std::partial_sort(snapshot_custom_v.begin(), snapshot_custom_v.begin() + kSize / 2, snapshot_custom_v.end(), std::less<MyType>()); - bool all_equal = true; - for (int i = 0; i < kSize; ++i) { - if (v[i].value != snapshot_v[i].value || v[i].value != snapshot_custom_v[i].value) { - all_equal = false; - } - if (i < kSize / 2) { - assert(v[i].value == 1); - } - } - assert(all_equal); -} - -#if TEST_STD_VER > 17 -constexpr bool test_constexpr() { - std::array<MyType, 10> v; - for (int i = 9; i >= 0; --i) { - v[9 - i].value = i; - } - std::partial_sort(v.begin(), v.begin() + 5, v.end()); - return std::is_sorted(v.begin(), v.begin() + 5); -} -#endif - -int main(int, char**) { - test_randomization(); - test_same(); -#if TEST_STD_VER > 17 - static_assert(test_constexpr(), ""); -#endif - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/pstl.iterator-requirements.verify.cpp b/libcxx/test/libcxx-03/algorithms/pstl.iterator-requirements.verify.cpp deleted file mode 100644 index e5bd7e7..0000000 --- a/libcxx/test/libcxx-03/algorithms/pstl.iterator-requirements.verify.cpp +++ /dev/null @@ -1,193 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// REQUIRES: stdlib=libc++ -// UNSUPPORTED: libcpp-has-no-incomplete-pstl - -// <algorithm> -// <numeric> - -// Make sure that all PSTL algorithms contain checks for iterator requirements. -// This is not a requirement from the Standard, but we strive to catch misuse in -// the PSTL both because we can, and because iterator category mistakes in the -// PSTL can lead to subtle bugs. - -// Ignore spurious errors after the initial static_assert failure. -// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error - -// We only diagnose this in C++20 and above because we implement the checks with concepts. -// UNSUPPORTED: c++17 - -#include <algorithm> -#include <cstddef> -#include <execution> -#include <numeric> - -#include "test_iterators.h" - -using non_forward_iterator = cpp17_input_iterator<int*>; -struct non_output_iterator : forward_iterator<int*> { - constexpr int const& operator*() const; // prevent it from being an output iterator -}; - -void f(non_forward_iterator non_fwd, non_output_iterator non_output, std::execution::sequenced_policy pol) { - auto pred = [](auto&&...) -> bool { return true; }; - auto func = [](auto&&...) -> int { return 1; }; - int* it = nullptr; - int* out = nullptr; - std::size_t n = 0; - int val = 0; - - { - (void)std::any_of(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: any_of}} - (void)std::all_of(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: all_of}} - (void)std::none_of(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: none_of}} - } - - { - (void)std::copy(pol, non_fwd, non_fwd, it); // expected-error@*:* {{static assertion failed: copy}} - (void)std::copy(pol, it, it, non_fwd); // expected-error@*:* {{static assertion failed: copy}} - (void)std::copy(pol, it, it, non_output); // expected-error@*:* {{static assertion failed: copy}} - } - { - (void)std::copy_n(pol, non_fwd, n, it); // expected-error@*:* {{static assertion failed: copy_n}} - (void)std::copy_n(pol, it, n, non_fwd); // expected-error@*:* {{static assertion failed: copy_n}} - (void)std::copy_n(pol, it, n, non_output); // expected-error@*:* {{static assertion failed: copy_n}} - } - - { - (void)std::count(pol, non_fwd, non_fwd, val); // expected-error@*:* {{static assertion failed: count}} - (void)std::count_if(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: count_if}} - } - - { - (void)std::equal(pol, non_fwd, non_fwd, it); // expected-error@*:* {{static assertion failed: equal}} - (void)std::equal(pol, it, it, non_fwd); // expected-error@*:* {{static assertion failed: equal}} - (void)std::equal(pol, non_fwd, non_fwd, it, pred); // expected-error@*:* {{static assertion failed: equal}} - (void)std::equal(pol, it, it, non_fwd, pred); // expected-error@*:* {{static assertion failed: equal}} - - (void)std::equal(pol, non_fwd, non_fwd, it, it); // expected-error@*:* {{static assertion failed: equal}} - (void)std::equal(pol, it, it, non_fwd, non_fwd); // expected-error@*:* {{static assertion failed: equal}} - (void)std::equal(pol, non_fwd, non_fwd, it, it, pred); // expected-error@*:* {{static assertion failed: equal}} - (void)std::equal(pol, it, it, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: equal}} - } - - { - (void)std::fill(pol, non_fwd, non_fwd, val); // expected-error@*:* {{static assertion failed: fill}} - (void)std::fill_n(pol, non_fwd, n, val); // expected-error@*:* {{static assertion failed: fill_n}} - } - - { - (void)std::find(pol, non_fwd, non_fwd, val); // expected-error@*:* {{static assertion failed: find}} - (void)std::find_if(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: find_if}} - (void)std::find_if_not(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: find_if_not}} - } - - { - (void)std::for_each(pol, non_fwd, non_fwd, func); // expected-error@*:* {{static assertion failed: for_each}} - (void)std::for_each_n(pol, non_fwd, n, func); // expected-error@*:* {{static assertion failed: for_each_n}} - } - - { - (void)std::generate(pol, non_fwd, non_fwd, func); // expected-error@*:* {{static assertion failed: generate}} - (void)std::generate_n(pol, non_fwd, n, func); // expected-error@*:* {{static assertion failed: generate_n}} - } - - { - (void)std::is_partitioned( - pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: is_partitioned}} - } - - { - (void)std::merge(pol, non_fwd, non_fwd, it, it, out); // expected-error@*:* {{static assertion failed: merge}} - (void)std::merge(pol, it, it, non_fwd, non_fwd, out); // expected-error@*:* {{static assertion failed: merge}} - (void)std::merge(pol, it, it, it, it, non_output); // expected-error@*:* {{static assertion failed: merge}} - - (void)std::merge(pol, non_fwd, non_fwd, it, it, out, pred); // expected-error@*:* {{static assertion failed: merge}} - (void)std::merge(pol, it, it, non_fwd, non_fwd, out, pred); // expected-error@*:* {{static assertion failed: merge}} - (void)std::merge(pol, it, it, it, it, non_output, pred); // expected-error@*:* {{static assertion failed: merge}} - } - - { - (void)std::move(pol, non_fwd, non_fwd, out); // expected-error@*:* {{static assertion failed: move}} - (void)std::move(pol, it, it, non_fwd); // expected-error@*:* {{static assertion failed: move}} - (void)std::move(pol, it, it, non_output); // expected-error@*:* {{static assertion failed: move}} - } - - { - (void)std::replace_if( - pol, non_fwd, non_fwd, pred, val); // expected-error@*:* {{static assertion failed: replace_if}} - (void)std::replace(pol, non_fwd, non_fwd, val, val); // expected-error@*:* {{static assertion failed: replace}} - - (void)std::replace_copy_if( - pol, non_fwd, non_fwd, out, pred, val); // expected-error@*:* {{static assertion failed: replace_copy_if}} - (void)std::replace_copy_if( - pol, it, it, non_fwd, pred, val); // expected-error@*:* {{static assertion failed: replace_copy_if}} - (void)std::replace_copy_if( - pol, it, it, non_output, pred, val); // expected-error@*:* {{static assertion failed: replace_copy_if}} - - (void)std::replace_copy( - pol, non_fwd, non_fwd, out, val, val); // expected-error@*:* {{static assertion failed: replace_copy}} - (void)std::replace_copy( - pol, it, it, non_fwd, val, val); // expected-error@*:* {{static assertion failed: replace_copy}} - (void)std::replace_copy( - pol, it, it, non_output, val, val); // expected-error@*:* {{static assertion failed: replace_copy}} - } - - { - (void)std::rotate_copy( - pol, non_fwd, non_fwd, non_fwd, out); // expected-error@*:* {{static assertion failed: rotate_copy}} - (void)std::rotate_copy(pol, it, it, it, non_fwd); // expected-error@*:* {{static assertion failed: rotate_copy}} - (void)std::rotate_copy(pol, it, it, it, non_output); // expected-error@*:* {{static assertion failed: rotate_copy}} - } - - { - (void)std::sort(pol, non_fwd, non_fwd); // expected-error@*:* {{static assertion failed: sort}} - (void)std::sort(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: sort}} - } - - { - (void)std::stable_sort(pol, non_fwd, non_fwd); // expected-error@*:* {{static assertion failed: stable_sort}} - (void)std::stable_sort(pol, non_fwd, non_fwd, pred); // expected-error@*:* {{static assertion failed: stable_sort}} - } - - { - (void)std::transform(pol, non_fwd, non_fwd, out, func); // expected-error@*:* {{static assertion failed: transform}} - (void)std::transform(pol, it, it, non_fwd, func); // expected-error@*:* {{static assertion failed: transform}} - (void)std::transform(pol, it, it, non_output, func); // expected-error@*:* {{static assertion failed: transform}} - - (void)std::transform( - pol, non_fwd, non_fwd, it, out, func); // expected-error@*:* {{static assertion failed: transform}} - (void)std::transform(pol, it, it, non_fwd, out, func); // expected-error@*:* {{static assertion failed: transform}} - (void)std::transform(pol, it, it, it, non_fwd, func); // expected-error@*:* {{static assertion failed: transform}} - (void)std::transform( - pol, it, it, it, non_output, func); // expected-error@*:* {{static assertion failed: transform}} - } - - { - (void)std::reduce(pol, non_fwd, non_fwd); // expected-error@*:* {{static assertion failed: reduce}} - (void)std::reduce(pol, non_fwd, non_fwd, val); // expected-error@*:* {{static assertion failed: reduce}} - (void)std::reduce(pol, non_fwd, non_fwd, val, func); // expected-error@*:* {{static assertion failed: reduce}} - } - - { - (void)std::transform_reduce( - pol, non_fwd, non_fwd, it, val); // expected-error@*:* {{static assertion failed: transform_reduce}} - (void)std::transform_reduce( - pol, it, it, non_fwd, val); // expected-error@*:* {{static assertion failed: transform_reduce}} - - (void)std::transform_reduce( - pol, non_fwd, non_fwd, it, val, func, func); // expected-error@*:* {{static assertion failed: transform_reduce}} - (void)std::transform_reduce( - pol, it, it, non_fwd, val, func, func); // expected-error@*:* {{static assertion failed: transform_reduce}} - - (void)std::transform_reduce( - pol, non_fwd, non_fwd, val, func, func); // expected-error@*:* {{static assertion failed: transform_reduce}} - } -} diff --git a/libcxx/test/libcxx-03/algorithms/ranges_robust_against_copying_comparators.pass.cpp b/libcxx/test/libcxx-03/algorithms/ranges_robust_against_copying_comparators.pass.cpp deleted file mode 100644 index dd02644..0000000 --- a/libcxx/test/libcxx-03/algorithms/ranges_robust_against_copying_comparators.pass.cpp +++ /dev/null @@ -1,264 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <algorithm> - -// this test checks that the comparators in the ranges algorithms aren't copied/moved - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <deque> -#include <type_traits> - -#include "test_macros.h" - -struct Less { - int *copies_; - constexpr explicit Less(int *copies) : copies_(copies) {} - constexpr Less(const Less& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr Less& operator=(const Less&) = default; - constexpr bool operator()(void*, void*) const { return false; } -}; - -struct Equal { - int *copies_; - constexpr explicit Equal(int *copies) : copies_(copies) {} - constexpr Equal(const Equal& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr Equal& operator=(const Equal&) = default; - constexpr bool operator()(void*, void*) const { return true; } -}; - -struct UnaryVoid { - int *copies_; - constexpr explicit UnaryVoid(int *copies) : copies_(copies) {} - constexpr UnaryVoid(const UnaryVoid& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr UnaryVoid& operator=(const UnaryVoid&) = default; - constexpr void operator()(void*) const {} -}; - -struct UnaryTrue { - int *copies_; - constexpr explicit UnaryTrue(int *copies) : copies_(copies) {} - constexpr UnaryTrue(const UnaryTrue& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr UnaryTrue& operator=(const UnaryTrue&) = default; - constexpr bool operator()(void*) const { return true; } -}; - -struct NullaryValue { - int *copies_; - constexpr explicit NullaryValue(int *copies) : copies_(copies) {} - constexpr NullaryValue(const NullaryValue& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr NullaryValue& operator=(const NullaryValue&) = default; - constexpr std::nullptr_t operator()() const { return nullptr; } -}; - -struct UnaryTransform { - int *copies_; - constexpr explicit UnaryTransform(int *copies) : copies_(copies) {} - constexpr UnaryTransform(const UnaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr UnaryTransform& operator=(const UnaryTransform&) = default; - constexpr std::nullptr_t operator()(void*) const { return nullptr; } -}; - -struct BinaryTransform { - int *copies_; - constexpr explicit BinaryTransform(int *copies) : copies_(copies) {} - constexpr BinaryTransform(const BinaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr BinaryTransform& operator=(const BinaryTransform&) = default; - constexpr std::nullptr_t operator()(void*, void*) const { return nullptr; } -}; - -constexpr bool all_the_algorithms() -{ - void *a[10] = {}; - void *b[10] = {}; - void *half[5] = {}; - void **first = a; - void **mid = a+5; - void **last = a+10; - void **first2 = b; - void **mid2 = b+5; - void **last2 = b+10; - void *value = nullptr; - int count = 1; - - int copies = 0; - (void)std::ranges::adjacent_find(first, last, Equal(&copies)); assert(copies == 0); - (void)std::ranges::adjacent_find(a, Equal(&copies)); assert(copies == 0); - (void)std::ranges::all_of(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::all_of(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::any_of(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::any_of(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::binary_search(first, last, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::binary_search(a, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::clamp(value, value, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::count_if(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::count_if(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::copy_if(first, last, first2, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::copy_if(a, first2, UnaryTrue(&copies)); assert(copies == 0); -#if TEST_STD_VER >= 23 - (void)std::ranges::ends_with(first, last, first2, last2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::ends_with(a, b, Equal(&copies)); assert(copies == 0); -#endif - (void)std::ranges::equal(first, last, first2, last2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::equal(a, b, Equal(&copies)); assert(copies == 0); - (void)std::ranges::equal_range(first, last, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::equal_range(a, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::find_end(first, last, first2, mid2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::find_end(a, b, Equal(&copies)); assert(copies == 0); - (void)std::ranges::find_first_of(first, last, first2, last2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::find_first_of(a, b, Equal(&copies)); assert(copies == 0); - (void)std::ranges::find_if(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::find_if(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::find_if_not(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::find_if_not(a, UnaryTrue(&copies)); assert(copies == 0); -#if TEST_STD_VER >= 23 - (void)std::ranges::find_last_if(first, last, UnaryTrue(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if(a, UnaryTrue(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if_not(first, last, UnaryTrue(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if_not(a, UnaryTrue(&copies)); - assert(copies == 0); -#endif - (void)std::ranges::for_each(first, last, UnaryVoid(&copies)); assert(copies == 1); copies = 0; - (void)std::ranges::for_each(a, UnaryVoid(&copies)); assert(copies == 1); copies = 0; - (void)std::ranges::for_each_n(first, count, UnaryVoid(&copies)); assert(copies == 1); copies = 0; - (void)std::ranges::generate(first, last, NullaryValue(&copies)); assert(copies == 0); - (void)std::ranges::generate(a, NullaryValue(&copies)); assert(copies == 0); - (void)std::ranges::generate_n(first, count, NullaryValue(&copies)); assert(copies == 0); - (void)std::ranges::includes(first, last, first2, last2, Less(&copies)); assert(copies == 0); - (void)std::ranges::includes(a, b, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_heap(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_heap(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_heap_until(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_heap_until(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_partitioned(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::is_partitioned(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::is_permutation(first, last, first2, last2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::is_permutation(a, b, Equal(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted_until(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted_until(a, Less(&copies)); assert(copies == 0); - if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED) { - (void)std::ranges::inplace_merge(first, mid, last, Less(&copies)); - assert(copies == 0); - (void)std::ranges::inplace_merge(a, mid, Less(&copies)); - assert(copies == 0); - } - (void)std::ranges::lexicographical_compare(first, last, first2, last2, Less(&copies)); assert(copies == 0); - (void)std::ranges::lexicographical_compare(a, b, Less(&copies)); assert(copies == 0); - (void)std::ranges::lower_bound(first, last, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::lower_bound(a, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::make_heap(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::make_heap(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::max(value, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::max({ value, value }, Less(&copies)); assert(copies == 0); - (void)std::ranges::max(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::max_element(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::max_element(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::merge(first, mid, mid, last, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::merge(half, half, b, Less(&copies)); assert(copies == 0); - (void)std::ranges::min(value, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::min({ value, value }, Less(&copies)); assert(copies == 0); - (void)std::ranges::min(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::min_element(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::min_element(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::minmax(value, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::minmax({ value, value }, Less(&copies)); assert(copies == 0); - (void)std::ranges::minmax(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::minmax_element(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::minmax_element(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::mismatch(first, last, first2, last2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::mismatch(a, b, Equal(&copies)); assert(copies == 0); - (void)std::ranges::next_permutation(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::next_permutation(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::none_of(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::none_of(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::nth_element(first, mid, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::nth_element(a, mid, Less(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort(first, mid, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort(a, mid, Less(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort_copy(first, last, first2, mid2, Less(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort_copy(a, b, Less(&copies)); assert(copies == 0); - (void)std::ranges::partition(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::partition(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::partition_copy(first, last, first2, last2, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::partition_copy(a, first2, last2, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::partition_point(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::partition_point(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::pop_heap(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::pop_heap(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::prev_permutation(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::prev_permutation(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::push_heap(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::push_heap(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::remove_copy_if(first, last, first2, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::remove_copy_if(a, first2, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::remove_if(first, last, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::remove_if(a, UnaryTrue(&copies)); assert(copies == 0); - (void)std::ranges::replace_copy_if(first, last, first2, UnaryTrue(&copies), value); assert(copies == 0); - (void)std::ranges::replace_copy_if(a, first2, UnaryTrue(&copies), value); assert(copies == 0); - (void)std::ranges::replace_if(first, last, UnaryTrue(&copies), value); assert(copies == 0); - (void)std::ranges::replace_if(a, UnaryTrue(&copies), value); assert(copies == 0); - (void)std::ranges::search(first, last, first2, mid2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::search(a, b, Equal(&copies)); assert(copies == 0); - (void)std::ranges::search_n(first, last, count, value, Equal(&copies)); assert(copies == 0); - (void)std::ranges::search_n(a, count, value, Equal(&copies)); assert(copies == 0); - (void)std::ranges::set_difference(first, mid, mid, last, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_difference(a, b, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_intersection(first, mid, mid, last, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_intersection(a, b, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_symmetric_difference(first, mid, mid, last, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_symmetric_difference(a, b, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_union(first, mid, mid, last, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::set_union(a, b, first2, Less(&copies)); assert(copies == 0); - (void)std::ranges::sort(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::sort(a, Less(&copies)); assert(copies == 0); - (void)std::ranges::sort_heap(first, last, Less(&copies)); assert(copies == 0); - (void)std::ranges::sort_heap(a, Less(&copies)); assert(copies == 0); - if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED) { - (void)std::ranges::stable_partition(first, last, UnaryTrue(&copies)); - assert(copies == 0); - (void)std::ranges::stable_partition(a, UnaryTrue(&copies)); - assert(copies == 0); - (void)std::ranges::stable_sort(first, last, Less(&copies)); - assert(copies == 0); - (void)std::ranges::stable_sort(a, Less(&copies)); - assert(copies == 0); - } -#if TEST_STD_VER > 20 - (void)std::ranges::starts_with(first, last, first2, last2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::starts_with(a, b, Equal(&copies)); assert(copies == 0); -#endif - (void)std::ranges::transform(first, last, first2, UnaryTransform(&copies)); assert(copies == 0); - (void)std::ranges::transform(a, first2, UnaryTransform(&copies)); assert(copies == 0); - (void)std::ranges::transform(first, mid, mid, last, first2, BinaryTransform(&copies)); assert(copies == 0); - (void)std::ranges::transform(a, b, first2, BinaryTransform(&copies)); assert(copies == 0); - (void)std::ranges::unique(first, last, Equal(&copies)); assert(copies == 0); - (void)std::ranges::unique(a, Equal(&copies)); assert(copies == 0); - (void)std::ranges::unique_copy(first, last, first2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::unique_copy(a, first2, Equal(&copies)); assert(copies == 0); - (void)std::ranges::upper_bound(first, last, value, Less(&copies)); assert(copies == 0); - (void)std::ranges::upper_bound(a, value, Less(&copies)); assert(copies == 0); - - return true; -} - -int main(int, char**) -{ - all_the_algorithms(); - static_assert(all_the_algorithms()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/ranges_robust_against_copying_projections.pass.cpp b/libcxx/test/libcxx-03/algorithms/ranges_robust_against_copying_projections.pass.cpp deleted file mode 100644 index 4919590..0000000 --- a/libcxx/test/libcxx-03/algorithms/ranges_robust_against_copying_projections.pass.cpp +++ /dev/null @@ -1,278 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <algorithm> - -// this test checks that the projections in the ranges algorithms aren't copied/moved - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <deque> -#include <type_traits> - -#include "test_macros.h" - -struct T {}; - -struct Proj { - int *copies_; - constexpr explicit Proj(int *copies) : copies_(copies) {} - constexpr Proj(const Proj& rhs) : copies_(rhs.copies_) { *copies_ += 1; } - constexpr Proj& operator=(const Proj&) = default; - constexpr void* operator()(T) const { return nullptr; } -}; - -struct Less { - constexpr bool operator()(void*, void*) const { return false; } -}; - -struct Equal { - constexpr bool operator()(void*, void*) const { return true; } -}; - -struct UnaryVoid { - constexpr void operator()(void*) const {} -}; - -struct UnaryTrue { - constexpr bool operator()(void*) const { return true; } -}; - -struct NullaryValue { - constexpr std::nullptr_t operator()() const { return nullptr; } -}; - -struct UnaryTransform { - constexpr T operator()(void*) const { return T(); } -}; - -struct BinaryTransform { - constexpr T operator()(void*, void*) const { return T(); } -}; - -constexpr bool all_the_algorithms() -{ - T a[10] = {}; - T b[10] = {}; - T half[5] = {}; - T *first = a; - T *mid = a+5; - T *last = a+10; - T *first2 = b; - T *mid2 = b+5; - T *last2 = b+10; - void *value = nullptr; - int count = 1; - - int copies = 0; - (void)std::ranges::adjacent_find(first, last, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::adjacent_find(a, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::all_of(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::all_of(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::any_of(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::any_of(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::binary_search(first, last, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::binary_search(a, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::clamp(T(), T(), T(), Less(), Proj(&copies)); assert(copies == 0); -#if TEST_STD_VER >= 23 - (void)std::ranges::contains(first, last, value, Proj(&copies)); - assert(copies == 0); - (void)std::ranges::contains(a, value, Proj(&copies)); - assert(copies == 0); - (void)std::ranges::contains_subrange(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::contains_subrange(a, b, Equal(), Proj(&copies), Proj(&copies)); - assert(copies == 0); -#endif - (void)std::ranges::count(first, last, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::count(a, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::count_if(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::count_if(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::copy_if(first, last, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::copy_if(a, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0); -#if TEST_STD_VER >= 23 - (void)std::ranges::ends_with(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::ends_with(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); -#endif - (void)std::ranges::equal(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::equal(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::equal_range(first, last, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::equal_range(a, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find(first, last, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::find(a, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_end(first, last, first2, mid2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_end(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_first_of(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_first_of(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_if(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_if(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_if_not(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::find_if_not(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); -#if TEST_STD_VER >= 23 - (void)std::ranges::find_last(first, last, value, Proj(&copies)); - assert(copies == 0); - (void)std::ranges::find_last(a, value, Proj(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if(first, last, UnaryTrue(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if(a, UnaryTrue(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if_not(first, last, UnaryTrue(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::find_last_if_not(a, UnaryTrue(), Proj(&copies)); - assert(copies == 0); -#endif - (void)std::ranges::for_each(first, last, UnaryVoid(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::for_each(a, UnaryVoid(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::for_each_n(first, count, UnaryVoid(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::includes(first, last, first2, last2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::includes(a, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_heap(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_heap(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_heap_until(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_heap_until(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_partitioned(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_partitioned(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_permutation(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_permutation(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted_until(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::is_sorted_until(a, Less(), Proj(&copies)); assert(copies == 0); - if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED) { - (void)std::ranges::inplace_merge(first, mid, last, Less(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::inplace_merge(a, mid, Less(), Proj(&copies)); - assert(copies == 0); - } - (void)std::ranges::lexicographical_compare(first, last, first2, last2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::lexicographical_compare(a, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::lower_bound(first, last, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::lower_bound(a, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::make_heap(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::make_heap(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::max(T(), T(), Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::max({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::max(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::max_element(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::max_element(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::merge(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::merge(half, half, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::min(T(), T(), Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::min({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::min(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::min_element(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::min_element(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::minmax(T(), T(), Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::minmax({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::minmax(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::minmax_element(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::minmax_element(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::mismatch(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::mismatch(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::next_permutation(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::next_permutation(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::none_of(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::none_of(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::nth_element(first, mid, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::nth_element(a, mid, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort(first, mid, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort(a, mid, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort_copy(first, last, first2, mid2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partial_sort_copy(a, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partition(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partition(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partition_copy(first, last, first2, last2, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partition_copy(a, first2, last2, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partition_point(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::partition_point(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::pop_heap(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::pop_heap(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::prev_permutation(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::prev_permutation(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::push_heap(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::push_heap(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove_copy(first, last, first2, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove_copy(a, first2, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove_copy_if(first, last, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove_copy_if(a, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove(first, last, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove(a, value, Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove_if(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::remove_if(a, UnaryTrue(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace_copy(first, last, first2, value, T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace_copy(a, first2, value, T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace_copy_if(first, last, first2, UnaryTrue(), T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace_copy_if(a, first2, UnaryTrue(), T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace(first, last, value, T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace(a, value, T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace_if(first, last, UnaryTrue(), T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::replace_if(a, UnaryTrue(), T(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::search(first, last, first2, mid2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::search(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::search_n(first, last, count, value, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::search_n(a, count, value, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_difference(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_difference(a, b, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_intersection(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_intersection(a, b, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_symmetric_difference(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_symmetric_difference(a, b, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_union(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::set_union(a, b, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::sort(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::sort(a, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::sort_heap(first, last, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::sort_heap(a, Less(), Proj(&copies)); assert(copies == 0); - if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED) { - (void)std::ranges::stable_partition(first, last, UnaryTrue(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::stable_partition(a, UnaryTrue(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::stable_sort(first, last, Less(), Proj(&copies)); - assert(copies == 0); - (void)std::ranges::stable_sort(a, Less(), Proj(&copies)); - assert(copies == 0); - } -#if TEST_STD_VER > 20 - (void)std::ranges::starts_with(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::starts_with(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0); -#endif - (void)std::ranges::transform(first, last, first2, UnaryTransform(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::transform(a, first2, UnaryTransform(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::transform(first, mid, mid, last, first2, BinaryTransform(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::transform(a, b, first2, BinaryTransform(), Proj(&copies), Proj(&copies)); assert(copies == 0); - (void)std::ranges::unique(first, last, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::unique(a, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::unique_copy(first, last, first2, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::unique_copy(a, first2, Equal(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::upper_bound(first, last, value, Less(), Proj(&copies)); assert(copies == 0); - (void)std::ranges::upper_bound(a, value, Less(), Proj(&copies)); assert(copies == 0); - - return true; -} - -void test_deque() { - std::deque<T> d; - int copies = 0; - void* value = nullptr; - - (void)std::ranges::find(d, value, Proj(&copies)); - assert(copies == 0); -} - -int main(int, char**) { - test_deque(); - all_the_algorithms(); - static_assert(all_the_algorithms()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/sort_stability.pass.cpp b/libcxx/test/libcxx-03/algorithms/sort_stability.pass.cpp deleted file mode 100644 index 712f12c2..0000000 --- a/libcxx/test/libcxx-03/algorithms/sort_stability.pass.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -// Test std::sort stability randomization - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY - -#include <algorithm> -#include <array> -#include <cassert> -#include <functional> -#include <iterator> -#include <vector> - -#include "test_macros.h" - -struct EqualType { - int value = 0; - constexpr bool operator<(const EqualType&) const { return false; } -}; - -std::vector<EqualType> deterministic() { - static constexpr int kSize = 100; - std::vector<EqualType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = kSize / 2 - i * (i % 2 ? -1 : 1); - } - std::less<EqualType> comp; - std::__sort_dispatch<std::_ClassicAlgPolicy>(v.begin(), v.end(), comp); - return v; -} - -void test_randomization() { - static constexpr int kSize = 100; - std::vector<EqualType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = kSize / 2 - i * (i % 2 ? -1 : 1); - } - auto deterministic_v = deterministic(); - std::sort(v.begin(), v.end()); - bool all_equal = true; - for (int i = 0; i < kSize; ++i) { - if (v[i].value != deterministic_v[i].value) { - all_equal = false; - } - } - assert(!all_equal); -} - -void test_same() { - static constexpr int kSize = 100; - std::vector<EqualType> v; - v.resize(kSize); - for (int i = 0; i < kSize; ++i) { - v[i].value = kSize / 2 - i * (i % 2 ? -1 : 1); - } - auto snapshot_v = v; - auto snapshot_custom_v = v; - std::sort(v.begin(), v.end()); - std::sort(snapshot_v.begin(), snapshot_v.end()); - std::sort(snapshot_custom_v.begin(), snapshot_custom_v.end(), - [](const EqualType&, const EqualType&) { return false; }); - bool all_equal = true; - for (int i = 0; i < kSize; ++i) { - if (v[i].value != snapshot_v[i].value || v[i].value != snapshot_custom_v[i].value) { - all_equal = false; - } - } - assert(all_equal); -} - -#if TEST_STD_VER > 17 -constexpr bool test_constexpr() { - std::array<EqualType, 10> v; - for (int i = 9; i >= 0; --i) { - v[9 - i].value = i; - } - std::sort(v.begin(), v.end()); - return std::is_sorted(v.begin(), v.end()); -} -#endif - -int main(int, char**) { - test_randomization(); - test_same(); -#if TEST_STD_VER > 17 - static_assert(test_constexpr(), ""); -#endif - return 0; -} diff --git a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp deleted file mode 100644 index 9c488c2..0000000 --- a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class I> -// concept __nothrow_forward_iterator; - -#include <memory> - -#include "test_iterators.h" - -static_assert(std::ranges::__nothrow_forward_iterator<forward_iterator<int*>>); -static_assert(std::forward_iterator<ForwardProxyIterator<int*>>); -static_assert(!std::ranges::__nothrow_forward_iterator<ForwardProxyIterator<int*>>); - -constexpr bool forward_subsumes_input(std::ranges::__nothrow_forward_iterator auto) { - return true; -} -constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_iterator auto); - -static_assert(forward_subsumes_input("foo")); diff --git a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp deleted file mode 100644 index 2ddfdf6..0000000 --- a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class R> -// concept __nothrow_forward_range; - -#include <memory> - -#include "test_iterators.h" -#include "test_range.h" - -static_assert(std::ranges::__nothrow_forward_range<test_range<forward_iterator>>); -static_assert(!std::ranges::__nothrow_forward_range<test_range<cpp20_input_iterator>>); -static_assert(std::ranges::forward_range<test_range<ForwardProxyIterator>>); -static_assert(!std::ranges::__nothrow_forward_range<test_range<ForwardProxyIterator>>); - -constexpr bool forward_subsumes_input(std::ranges::__nothrow_forward_range auto&&) { - return true; -} -constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_range auto&&); - -static_assert(forward_subsumes_input("foo")); diff --git a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_iterator.compile.pass.cpp deleted file mode 100644 index 2da3f42..0000000 --- a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_iterator.compile.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class I> -// concept __nothrow_input_iterator; - -#include <memory> - -#include "test_iterators.h" - -struct InputProxyIterator { - using value_type = int; - using difference_type = int; - InputProxyIterator& operator++(); - InputProxyIterator operator++(int); - - int operator*() const; -}; - -static_assert(std::ranges::__nothrow_input_iterator<cpp20_input_iterator<int*>>); -static_assert(!std::ranges::__nothrow_input_iterator<cpp17_output_iterator<int*>>); -static_assert(std::input_iterator<InputProxyIterator>); -static_assert(!std::ranges::__nothrow_input_iterator<InputProxyIterator>); diff --git a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_range.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_range.compile.pass.cpp deleted file mode 100644 index 2f851c4b..0000000 --- a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_input_range.compile.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class R> -// concept __nothrow_input_range; - -#include <memory> - -#include "test_iterators.h" -#include "test_range.h" - -// Has to be a template to work with `test_range`. -template <typename> -struct InputProxyIterator { - using value_type = int; - using difference_type = int; - InputProxyIterator& operator++(); - InputProxyIterator operator++(int); - - int operator*() const; -}; - -static_assert(std::ranges::__nothrow_input_range<test_range<cpp20_input_iterator>>); -static_assert(std::ranges::input_range<test_range<InputProxyIterator>>); -static_assert(!std::ranges::__nothrow_input_range<test_range<InputProxyIterator>>); diff --git a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_sentinel_for.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_sentinel_for.compile.pass.cpp deleted file mode 100644 index a605095..0000000 --- a/libcxx/test/libcxx-03/algorithms/specialized.algorithms/special.mem.concepts/nothrow_sentinel_for.compile.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class S, class I> -// concept __nothrow_sentinel_for; - -#include <iterator> -#include <memory> - -static_assert(std::ranges::__nothrow_sentinel_for<int*, int*>); -static_assert(!std::ranges::__nothrow_sentinel_for<int*, long*>); - -// Because `__nothrow_sentinel_for` is essentially an alias for `sentinel_for`, -// the two concepts should subsume each other. - -constexpr bool ntsf_subsumes_sf(std::ranges::__nothrow_sentinel_for<char*> auto) requires true { - return true; -} -constexpr bool ntsf_subsumes_sf(std::sentinel_for<char*> auto); - -static_assert(ntsf_subsumes_sf("foo")); - -constexpr bool sf_subsumes_ntsf(std::sentinel_for<char*> auto) requires true { - return true; -} -constexpr bool sf_subsumes_ntsf(std::ranges::__nothrow_sentinel_for<char*> auto); - -static_assert(sf_subsumes_ntsf("foo")); diff --git a/libcxx/test/libcxx-03/algorithms/vectorization.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/vectorization.compile.pass.cpp deleted file mode 100644 index 733a147..0000000 --- a/libcxx/test/libcxx-03/algorithms/vectorization.compile.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// We don't know how to vectorize algorithms on GCC -// XFAIL: gcc - -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - -// We don't vectorize algorithms before C++14 -// XFAIL: c++03, c++11 - -// We don't vectorize algorithms on AIX right now. -// XFAIL: target={{.+}}-aix{{.*}} - -// We don't vectorize on AppleClang 15 since that apparently breaks std::mismatch -// XFAIL: apple-clang-15 - -// This test ensures that we enable the vectorization of algorithms on the expected -// platforms. - -#include <algorithm> - -#ifndef _LIBCPP_VECTORIZE_ALGORITHMS -# error It looks like the test needs to be updated since _LIBCPP_VECTORIZE_ALGORITHMS isn't defined anymore -#endif - -#if !_LIBCPP_VECTORIZE_ALGORITHMS -# error Algorithms should be vectorized on this platform -#endif diff --git a/libcxx/test/libcxx-03/assertions/modes/debug.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/debug.pass.cpp deleted file mode 100644 index ea9770b0..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/debug.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that assertions trigger without the user having to do anything when the debug mode has been enabled -// by default. - -// REQUIRES: libcpp-hardening-mode=debug -// `check_assertion.h` is only available starting from C++11. -// UNSUPPORTED: c++03 -// `check_assertion.h` requires Unix headers. -// REQUIRES: has-unix-headers - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/assertions/modes/extensive.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/extensive.pass.cpp deleted file mode 100644 index 5743f95..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/extensive.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that assertions trigger without the user having to do anything when the extensive hardening mode -// has been enabled by default. - -// REQUIRES: libcpp-hardening-mode=extensive -// `check_assertion.h` is only available starting from C++11. -// UNSUPPORTED: c++03 -// `check_assertion.h` requires Unix headers. -// REQUIRES: has-unix-headers - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/assertions/modes/fast.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/fast.pass.cpp deleted file mode 100644 index 8518185..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/fast.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that assertions trigger without the user having to do anything when the fast hardening mode has -// been enabled by default. - -// REQUIRES: libcpp-hardening-mode=fast -// `check_assertion.h` is only available starting from C++11. -// UNSUPPORTED: c++03 -// `check_assertion.h` requires Unix headers. -// REQUIRES: has-unix-headers - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/assertions/modes/override_with_debug_mode.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/override_with_debug_mode.pass.cpp deleted file mode 100644 index 02565d0b..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/override_with_debug_mode.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that we can override any hardening mode with the debug mode on a per-TU basis. - -// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support. -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-localization -// The ability to set a custom abort message is required to compare the assertion message. -// XFAIL: availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_INTERNAL(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should fire"); }(), - "Debug-mode assertions should fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/assertions/modes/override_with_extensive_mode.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/override_with_extensive_mode.pass.cpp deleted file mode 100644 index 74fe70f..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/override_with_extensive_mode.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that we can override any hardening mode with the extensive hardening mode on a per-TU basis. - -// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support. -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-localization -// The ability to set a custom abort message is required to compare the assertion message (which only happens in the -// debug mode). -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// HWASAN replaces TRAP with abort or error exit code. -// XFAIL: hwasan -// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE( - [] { _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should fire"); }(), - "Extensive-mode assertions should fire"); - _LIBCPP_ASSERT_INTERNAL(false, "Debug-mode assertions should not fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/assertions/modes/override_with_fast_mode.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/override_with_fast_mode.pass.cpp deleted file mode 100644 index f243897..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/override_with_fast_mode.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that we can override any hardening mode with the fast mode on a per-TU basis. - -// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support. -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-localization -// The ability to set a custom abort message is required to compare the assertion message (which only happens in the -// debug mode). -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// HWASAN replaces TRAP with abort or error exit code. -// XFAIL: hwasan -// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Fast-mode assertions should fire"); }(), - "Fast-mode assertions should fire"); - _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(false, "Extensive-mode assertions should not fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/assertions/modes/override_with_unchecked_mode.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/override_with_unchecked_mode.pass.cpp deleted file mode 100644 index 0922556..0000000 --- a/libcxx/test/libcxx-03/assertions/modes/override_with_unchecked_mode.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 ensures that we can override any hardening mode with the unchecked mode on a per-TU basis. - -// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support. -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-localization -// ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE - -#include <cassert> -#include "check_assertion.h" - -int main(int, char**) { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Also should not fire"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.align/align.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.align/align.pass.cpp deleted file mode 100644 index 5990fc4..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.align/align.pass.cpp +++ /dev/null @@ -1,113 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++03 -// REQUIRES: has-1024-bit-atomics -// ADDITIONAL_COMPILE_FLAGS: -Wno-psabi -// ... since C++20 std::__atomic_base initializes, so we get a warning about an -// ABI change for vector variants since the constructor code for that is -// different if one were to compile with architecture-specific vector -// extensions enabled. -// This however isn't ABI breaking as it was impossible for any code to trigger -// this without using libc++ internals. - -// GCC currently fails because it needs -fabi-version=6 to fix mangling of -// std::atomic when used with __attribute__((vector(X))). -// XFAIL: gcc - -// This fails on PowerPC, as the LLIArr2 and Padding structs do not have -// adequate alignment, despite these types returning true for the query of -// being lock-free. This is an issue that occurs when linking in the -// PowerPC GNU libatomic library into the test. -// XFAIL: target=powerpc{{.*}}le-unknown-linux-gnu - -// <atomic> - -// Verify that the content of atomic<T> is properly aligned if the type is -// lock-free. This can't be observed through the atomic<T> API. It is -// nonetheless required for correctness of the implementation: lock-free implies -// that ISA instructions are used, and these instructions assume "suitable -// alignment". Supported architectures all require natural alignment for -// lock-freedom (e.g. load-linked / store-conditional, or cmpxchg). - -#include <atomic> -#include <cassert> -#include <cstddef> - -template <typename T> -struct atomic_test : public std::__atomic_base<T> { - atomic_test() { - if (this->is_lock_free()) { - using AtomicImpl = decltype(this->__a_); - assert(alignof(AtomicImpl) >= sizeof(AtomicImpl) && - "expected natural alignment for lock-free type"); - } - } -}; - -int main(int, char**) { - -// structs and unions can't be defined in the template invocation. -// Work around this with a typedef. -#define CHECK_ALIGNMENT(T) \ - do { \ - typedef T type; \ - atomic_test<type> t; \ - } while (0) - - CHECK_ALIGNMENT(bool); - CHECK_ALIGNMENT(char); - CHECK_ALIGNMENT(signed char); - CHECK_ALIGNMENT(unsigned char); - CHECK_ALIGNMENT(char16_t); - CHECK_ALIGNMENT(char32_t); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - CHECK_ALIGNMENT(wchar_t); -#endif - CHECK_ALIGNMENT(short); - CHECK_ALIGNMENT(unsigned short); - CHECK_ALIGNMENT(int); - CHECK_ALIGNMENT(unsigned int); - CHECK_ALIGNMENT(long); - CHECK_ALIGNMENT(unsigned long); - CHECK_ALIGNMENT(long long); - CHECK_ALIGNMENT(unsigned long long); - CHECK_ALIGNMENT(std::nullptr_t); - CHECK_ALIGNMENT(void *); - CHECK_ALIGNMENT(float); - CHECK_ALIGNMENT(double); - CHECK_ALIGNMENT(long double); - CHECK_ALIGNMENT(int __attribute__((vector_size(1 * sizeof(int))))); - CHECK_ALIGNMENT(int __attribute__((vector_size(2 * sizeof(int))))); - CHECK_ALIGNMENT(int __attribute__((vector_size(4 * sizeof(int))))); - CHECK_ALIGNMENT(int __attribute__((vector_size(16 * sizeof(int))))); - CHECK_ALIGNMENT(int __attribute__((vector_size(32 * sizeof(int))))); - CHECK_ALIGNMENT(float __attribute__((vector_size(1 * sizeof(float))))); - CHECK_ALIGNMENT(float __attribute__((vector_size(2 * sizeof(float))))); - CHECK_ALIGNMENT(float __attribute__((vector_size(4 * sizeof(float))))); - CHECK_ALIGNMENT(float __attribute__((vector_size(16 * sizeof(float))))); - CHECK_ALIGNMENT(float __attribute__((vector_size(32 * sizeof(float))))); - CHECK_ALIGNMENT(double __attribute__((vector_size(1 * sizeof(double))))); - CHECK_ALIGNMENT(double __attribute__((vector_size(2 * sizeof(double))))); - CHECK_ALIGNMENT(double __attribute__((vector_size(4 * sizeof(double))))); - CHECK_ALIGNMENT(double __attribute__((vector_size(16 * sizeof(double))))); - CHECK_ALIGNMENT(double __attribute__((vector_size(32 * sizeof(double))))); - CHECK_ALIGNMENT(struct Empty {}); - CHECK_ALIGNMENT(struct OneInt { int i; }); - CHECK_ALIGNMENT(struct IntArr2 { int i[2]; }); - CHECK_ALIGNMENT(struct FloatArr3 { float i[3]; }); - CHECK_ALIGNMENT(struct LLIArr2 { long long int i[2]; }); - CHECK_ALIGNMENT(struct LLIArr4 { long long int i[4]; }); - CHECK_ALIGNMENT(struct LLIArr8 { long long int i[8]; }); - CHECK_ALIGNMENT(struct LLIArr16 { long long int i[16]; }); - CHECK_ALIGNMENT(struct Padding { char c; /* padding */ long long int i; }); - CHECK_ALIGNMENT(union IntFloat { int i; float f; }); - CHECK_ALIGNMENT(enum class StrongEnum { foo }); - - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.compare_exchange_strong.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/assert.compare_exchange_strong.pass.cpp deleted file mode 100644 index 92f6a62..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.compare_exchange_strong.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none || libcpp-hardening-mode=fast -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-user-defined-warnings - -// <atomic> - -// bool compare_exchange_strong(T& expected, T desired, memory_order success, memory_order failure) const noexcept; -// -// Preconditions: failure is memory_order::relaxed, memory_order::consume, memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -#include "atomic_helpers.h" -#include "check_assertion.h" - -template <typename T> -struct TestCompareExchangeStrongInvalidMemoryOrder { - void operator()() const { - { // no assertion should trigger here - T x(T(1)); - std::atomic_ref<T> const a(x); - T t(T(2)); - a.compare_exchange_strong(t, T(3), std::memory_order_relaxed, std::memory_order_relaxed); - } - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - T t(T(2)); - a.compare_exchange_strong(t, T(3), std::memory_order_relaxed, std::memory_order_release); - }()), - "atomic_ref: failure memory order argument to strong atomic compare-and-exchange operation is invalid"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - T t(T(2)); - a.compare_exchange_strong(t, T(3), std::memory_order_relaxed, std::memory_order_acq_rel); - }()), - "atomic_ref: failure memory order argument to strong atomic compare-and-exchange operation is invalid"); - } -}; - -int main(int, char**) { - TestEachAtomicType<TestCompareExchangeStrongInvalidMemoryOrder>()(); - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.compare_exchange_weak.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/assert.compare_exchange_weak.pass.cpp deleted file mode 100644 index 3bee003..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.compare_exchange_weak.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none || libcpp-hardening-mode=fast -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-user-defined-warnings - -// <atomic> - -// bool compare_exchange_weak(T& expected, T desired, memory_order success, memory_order failure) const noexcept; -// -// Preconditions: failure is memory_order::relaxed, memory_order::consume, memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -#include "atomic_helpers.h" -#include "check_assertion.h" - -template <typename T> -struct TestCompareExchangeWeakInvalidMemoryOrder { - void operator()() const { - { // no assertion should trigger here - T x(T(1)); - std::atomic_ref<T> const a(x); - T t(T(2)); - a.compare_exchange_weak(t, T(3), std::memory_order_relaxed, std::memory_order_relaxed); - } - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - T t(T(2)); - a.compare_exchange_weak(t, T(3), std::memory_order_relaxed, std::memory_order_release); - }()), - "atomic_ref: failure memory order argument to weak atomic compare-and-exchange operation is invalid"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - T t(T(2)); - a.compare_exchange_weak(t, T(3), std::memory_order_relaxed, std::memory_order_acq_rel); - }()), - "atomic_ref: failure memory order argument to weak atomic compare-and-exchange operation is invalid"); - } -}; - -int main(int, char**) { - TestEachAtomicType<TestCompareExchangeWeakInvalidMemoryOrder>()(); - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.ctor.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/assert.ctor.pass.cpp deleted file mode 100644 index 3d47004..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.ctor.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none || libcpp-hardening-mode=fast -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <atomic> - -// atomic_ref(T& obj); -// -// Preconditions: The referenced object is aligned to required_alignment. - -#include <atomic> -#include <cstddef> - -#include "check_assertion.h" - -int main(int, char**) { - { // no assertion should trigger here - alignas(float) std::byte c[sizeof(float)]; - float* f = new (c) float(3.14f); - [[maybe_unused]] std::atomic_ref<float> r(*f); - } - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - alignas(float) std::byte c[2 * sizeof(float)]; // intentionally larger - float* f = new (c + 1) float(3.14f); // intentionally misaligned - [[maybe_unused]] std::atomic_ref<float> r(*f); - }()), - "atomic_ref ctor: referenced object must be aligned to required_alignment"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.load.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/assert.load.pass.cpp deleted file mode 100644 index 504d135..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.load.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none || libcpp-hardening-mode=fast -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-user-defined-warnings - -// <atomic> - -// T load(memory_order order = memory_order::seq_cst) const noexcept; -// -// Preconditions: order is memory_order::relaxed, memory_order::consume, memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -#include "atomic_helpers.h" -#include "check_assertion.h" - -template <typename T> -struct TestLoadInvalidMemoryOrder { - void operator()() const { - { // no assertion should trigger here - T x(T(1)); - std::atomic_ref<T> const a(x); - (void)a.load(std::memory_order_relaxed); - } - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - (void)a.load(std::memory_order_release); - }()), - "atomic_ref: memory order argument to atomic load operation is invalid"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - (void)a.load(std::memory_order_acq_rel); - }()), - "atomic_ref: memory order argument to atomic load operation is invalid"); - } -}; - -int main(int, char**) { - TestEachAtomicType<TestLoadInvalidMemoryOrder>()(); - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.store.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/assert.store.pass.cpp deleted file mode 100644 index 1afa425..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.store.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none || libcpp-hardening-mode=fast -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-user-defined-warnings - -// <atomic> - -// void store(T desired, memory_order order = memory_order::seq_cst) const noexcept; -// -// Preconditions: order is memory_order::relaxed, memory_order::release, or memory_order::seq_cst. - -#include <atomic> - -#include "atomic_helpers.h" -#include "check_assertion.h" - -template <typename T> -struct TestStoreInvalidMemoryOrder { - void operator()() const { - { // no assertion should trigger here - T x(T(1)); - std::atomic_ref<T> const a(x); - a.store(T(2), std::memory_order_relaxed); - } - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - a.store(T(2), std::memory_order_consume); - }()), - "atomic_ref: memory order argument to atomic store operation is invalid"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - a.store(T(2), std::memory_order_acquire); - }()), - "atomic_ref: memory order argument to atomic store operation is invalid"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - a.store(T(2), std::memory_order_acq_rel); - }()), - "atomic_ref: memory order argument to atomic store operation is invalid"); - } -}; - -int main(int, char**) { - TestEachAtomicType<TestStoreInvalidMemoryOrder>()(); - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.wait.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/assert.wait.pass.cpp deleted file mode 100644 index 39178d2..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/assert.wait.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none || libcpp-hardening-mode=fast -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-user-defined-warnings - -// <atomic> - -// void wait(T old, memory_order order = memory_order::seq_cst) const noexcept; -// -// Preconditions: order is memory_order::relaxed, memory_order::consume, memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -#include "atomic_helpers.h" -#include "check_assertion.h" - -template <typename T> -struct TestWaitInvalidMemoryOrder { - void operator()() const { - { // no assertion should trigger here - T x(T(1)); - std::atomic_ref<T> const a(x); - a.wait(T(2), std::memory_order_relaxed); - } - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - a.wait(T(2), std::memory_order_release); - }()), - "atomic_ref: memory order argument to atomic wait operation is invalid"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - T x(T(1)); - std::atomic_ref<T> const a(x); - a.wait(T(2), std::memory_order_acq_rel); - }()), - "atomic_ref: memory order argument to atomic wait operation is invalid"); - } -}; - -int main(int, char**) { - TestEachAtomicType<TestWaitInvalidMemoryOrder>()(); - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/compare_exchange_strong.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/compare_exchange_strong.verify.cpp deleted file mode 100644 index 427c82d..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/compare_exchange_strong.verify.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: diagnose-if-support -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <atomic> - -// bool compare_exchange_strong(T& expected, T desired, memory_order success, -// memory_order failure) const noexcept; -// -// Preconditions: failure is memory_order::relaxed, memory_order::consume, -// memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -void test() { - using T = int; - - T x(T(1)); - std::atomic_ref const a(x); - - T expected(T(2)); - T const desired(T(3)); - std::memory_order const success = std::memory_order_relaxed; - // clang-format off - a.compare_exchange_strong(expected, desired, success, std::memory_order_relaxed); - a.compare_exchange_strong(expected, desired, success, std::memory_order_consume); - a.compare_exchange_strong(expected, desired, success, std::memory_order_acquire); - a.compare_exchange_strong(expected, desired, success, std::memory_order_seq_cst); - a.compare_exchange_strong(expected, desired, success, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}} - a.compare_exchange_strong(expected, desired, success, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/compare_exchange_weak.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/compare_exchange_weak.verify.cpp deleted file mode 100644 index 6a10460..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/compare_exchange_weak.verify.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: diagnose-if-support -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <atomic> - -// bool compare_exchange_weak(T& expected, T desired, memory_order success, -// memory_order failure) const noexcept; -// -// Preconditions: failure is memory_order::relaxed, memory_order::consume, -// memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -void test() { - using T = int; - - T x(T(42)); - std::atomic_ref const a(x); - - T expected(T(2)); - T const desired(T(3)); - std::memory_order const success = std::memory_order_relaxed; - // clang-format off - a.compare_exchange_weak(expected, desired, success, std::memory_order_relaxed); - a.compare_exchange_weak(expected, desired, success, std::memory_order_consume); - a.compare_exchange_weak(expected, desired, success, std::memory_order_acquire); - a.compare_exchange_weak(expected, desired, success, std::memory_order_seq_cst); - a.compare_exchange_weak(expected, desired, success, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}} - a.compare_exchange_weak(expected, desired, success, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/load.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/load.verify.cpp deleted file mode 100644 index 9fdecb1..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/load.verify.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: diagnose-if-support -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <atomic> - -// T load(memory_order order = memory_order::seq_cst) const noexcept; -// -// Preconditions: order is memory_order::relaxed, memory_order::consume, memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -void test() { - using T = int; - - T x(T(1)); - std::atomic_ref const a(x); - - // clang-format off - (void)a.load(std::memory_order_relaxed); - (void)a.load(std::memory_order_consume); - (void)a.load(std::memory_order_acquire); - (void)a.load(std::memory_order_seq_cst); - (void)a.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}} - (void)a.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/store.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/store.verify.cpp deleted file mode 100644 index 0be4e5e..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/store.verify.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: diagnose-if-support -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <atomic> - -// void store(T desired, memory_order order = memory_order::seq_cst) const noexcept; -// -// Preconditions: order is memory_order::relaxed, memory_order::release, or memory_order::seq_cst. - -#include <atomic> - -void test() { - using T = int; - - T x(T(1)); - std::atomic_ref const a(x); - - T const desired(T(2)); - - // clang-format off - a.store(desired, std::memory_order_relaxed); - a.store(desired, std::memory_order_release); - a.store(desired, std::memory_order_seq_cst); - a.store(desired, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}} - a.store(desired, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}} - a.store(desired, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.ref/wait.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.ref/wait.verify.cpp deleted file mode 100644 index 718e716..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.ref/wait.verify.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: diagnose-if-support -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <atomic> - -// void wait(T old, memory_order order = memory_order::seq_cst) const noexcept; -// -// Preconditions: order is memory_order::relaxed, memory_order::consume, memory_order::acquire, or memory_order::seq_cst. - -#include <atomic> - -void test() { - using T = int; - - T x(T(1)); - std::atomic_ref const a(x); - - T const old(T(2)); - - // clang-format off - a.wait(old, std::memory_order_relaxed); - a.wait(old, std::memory_order_consume); - a.wait(old, std::memory_order_acquire); - a.wait(old, std::memory_order_seq_cst); - a.wait(old, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}} - a.wait(old, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp deleted file mode 100644 index 349dc51..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// This test verifies that <stdatomic.h> redirects to <atomic>. - -// Before C++23, <stdatomic.h> can be included after <atomic>, but including it -// first doesn't work because its macros break <atomic>. Fixing that is the point -// of the C++23 change that added <stdatomic.h> to C++. Thus, this test verifies -// that <stdatomic.h> can be included first. -#include <stdatomic.h> -#include <atomic> - -#include <type_traits> - -static_assert(std::is_same<atomic_int, std::atomic<int> >::value, ""); diff --git a/libcxx/test/libcxx-03/atomics/atomics.syn/wait.issue_85107.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.syn/wait.issue_85107.pass.cpp deleted file mode 100644 index 03eaa0e..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.syn/wait.issue_85107.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-threads - -// This bug was first fixed in LLVM 19. This can't be XFAIL because -// the test is a no-op (and would XPASS) on some targets. -// UNSUPPORTED: using-built-library-before-llvm-19 - -// XFAIL: availability-synchronization_library-missing - -// This is a regression test for https://github.com/llvm/llvm-project/issues/85107, which describes -// how we were using UL_COMPARE_AND_WAIT instead of UL_COMPARE_AND_WAIT64 in the implementation of -// atomic::wait, leading to potential infinite hangs. - -#include <atomic> -#include <cassert> -#include <chrono> - -#include "make_test_thread.h" - -int main(int, char**) { - if constexpr (sizeof(std::__cxx_contention_t) == 8 && sizeof(long) > 4) { - std::atomic<bool> done = false; - auto const timeout = std::chrono::system_clock::now() + std::chrono::seconds(600); // fail after 10 minutes - - auto timeout_thread = support::make_test_thread([&] { - while (!done) { - assert(std::chrono::system_clock::now() < timeout); // make sure we don't hang forever - } - }); - - // https://github.com/llvm/llvm-project/issues/85107 - // [libc++] atomic_wait uses UL_COMPARE_AND_WAIT when it should use UL_COMPARE_AND_WAIT64 on Darwin - constexpr std::__cxx_contention_t old_val = 0; - constexpr std::__cxx_contention_t new_val = old_val + (1ll << 32); - std::__cxx_atomic_contention_t ct(new_val); - - // This would hang forever if the bug is present, but the test will fail in a bounded amount of - // time due to the timeout above. - std::__libcpp_atomic_wait(&ct, old_val); - - done = true; - timeout_thread.join(); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.generic/atomics.types.float/lockfree.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.generic/atomics.types.float/lockfree.pass.cpp deleted file mode 100644 index 352e705..0000000 --- a/libcxx/test/libcxx-03/atomics/atomics.types.generic/atomics.types.float/lockfree.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: !has-64-bit-atomics - -// static constexpr bool is_always_lock_free = implementation-defined; -// bool is_lock_free() const volatile noexcept; -// bool is_lock_free() const noexcept; - -#include <atomic> -#include <cassert> -#include <concepts> - -#include "test_macros.h" - -template <class T> -void test() { - // static constexpr bool is_always_lock_free = implementation-defined; - { - bool r = std::atomic<T>::is_always_lock_free; - assert(r == __atomic_always_lock_free(sizeof(std::__cxx_atomic_impl<T>), 0)); - } - - // bool is_lock_free() const volatile noexcept; - { - const volatile std::atomic<T> a; - bool r = a.is_lock_free(); - assert(r == __cxx_atomic_is_lock_free(sizeof(std::__cxx_atomic_impl<T>))); - } - - // bool is_lock_free() const noexcept; - { - const std::atomic<T> a; - bool r = a.is_lock_free(); - assert(r == __cxx_atomic_is_lock_free(sizeof(std::__cxx_atomic_impl<T>))); - } -} - -int main(int, char**) { - test<float>(); - test<double>(); - // TODO https://github.com/llvm/llvm-project/issues/47978 - // test<long double>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/atomics/bit-int.verify.cpp b/libcxx/test/libcxx-03/atomics/bit-int.verify.cpp deleted file mode 100644 index 03880a1b..0000000 --- a/libcxx/test/libcxx-03/atomics/bit-int.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <atomic> - -// Make sure that `std::atomic` doesn't work with `_BitInt`. The intent is to -// disable them for now until their behavior can be designed better later. -// See https://reviews.llvm.org/D84049 for details. - -// UNSUPPORTED: c++03 - -#include <atomic> - -void f() { - // expected-error@*:*1 {{_Atomic cannot be applied to integer type '_BitInt(32)'}} - std::atomic<_BitInt(32)> x(42); -} diff --git a/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_integer.compile.pass.cpp b/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_integer.compile.pass.cpp deleted file mode 100644 index 4958a25..0000000 --- a/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_integer.compile.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Concept helpers for the internal type traits for the fundamental types. - -// template <class _Tp> -// concept __signed_or_unsigned_integer; - -#include <__type_traits/integer_traits.h> - -#include "test_macros.h" - -struct SomeObject {}; - -enum SomeEnum {}; - -enum class SomeScopedEnum {}; - -// Unsigned -static_assert(std::__signed_or_unsigned_integer<unsigned char>); -static_assert(std::__signed_or_unsigned_integer<unsigned short int>); -static_assert(std::__signed_or_unsigned_integer<unsigned int>); -static_assert(std::__signed_or_unsigned_integer<unsigned long int>); -static_assert(std::__signed_or_unsigned_integer<unsigned long long int>); -static_assert(std::__signed_or_unsigned_integer<unsigned short int>); -#if _LIBCPP_HAS_INT128 -static_assert(std::__signed_or_unsigned_integer<__uint128_t>); -#endif -// Signed -static_assert(std::__signed_or_unsigned_integer<signed char>); -static_assert(std::__signed_or_unsigned_integer<short int>); -static_assert(std::__signed_or_unsigned_integer<int>); -static_assert(std::__signed_or_unsigned_integer<long int>); -static_assert(std::__signed_or_unsigned_integer<long long int>); -static_assert(std::__signed_or_unsigned_integer<short int>); -#if _LIBCPP_HAS_INT128 -static_assert(std::__signed_or_unsigned_integer<__int128_t>); -#endif -// Non-integer -static_assert(!std::__signed_or_unsigned_integer<bool>); -static_assert(!std::__signed_or_unsigned_integer<char>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__signed_or_unsigned_integer<wchar_t>); -#endif -static_assert(!std::__signed_or_unsigned_integer<char8_t>); -static_assert(!std::__signed_or_unsigned_integer<char16_t>); -static_assert(!std::__signed_or_unsigned_integer<char32_t>); -static_assert(!std::__signed_or_unsigned_integer<float>); -static_assert(!std::__signed_or_unsigned_integer<double>); -static_assert(!std::__signed_or_unsigned_integer<long double>); -static_assert(!std::__signed_or_unsigned_integer<void>); -static_assert(!std::__signed_or_unsigned_integer<int*>); -static_assert(!std::__signed_or_unsigned_integer<unsigned int*>); -static_assert(!std::__signed_or_unsigned_integer<SomeObject>); -static_assert(!std::__signed_or_unsigned_integer<SomeEnum>); -static_assert(!std::__signed_or_unsigned_integer<SomeScopedEnum>); diff --git a/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_signed_integer.compile.pass.cpp b/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_signed_integer.compile.pass.cpp deleted file mode 100644 index 3fa3426..0000000 --- a/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_signed_integer.compile.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Concept helpers for the internal type traits for the fundamental types. - -// template <class _Tp> -// concept __signed_integer; - -#include <__type_traits/integer_traits.h> - -#include "test_macros.h" - -struct SomeObject {}; - -enum SomeEnum {}; - -enum class SomeScopedEnum {}; - -// Unsigned -static_assert(!std::__signed_integer<unsigned char>); -static_assert(!std::__signed_integer<unsigned short int>); -static_assert(!std::__signed_integer<unsigned int>); -static_assert(!std::__signed_integer<unsigned long int>); -static_assert(!std::__signed_integer<unsigned long long int>); -static_assert(!std::__signed_integer<unsigned short int>); -#if _LIBCPP_HAS_INT128 -static_assert(!std::__signed_integer<__uint128_t>); -#endif -// Signed -static_assert(std::__signed_integer<signed char>); -static_assert(std::__signed_integer<short int>); -static_assert(std::__signed_integer<int>); -static_assert(std::__signed_integer<long int>); -static_assert(std::__signed_integer<long long int>); -static_assert(std::__signed_integer<short int>); -#if _LIBCPP_HAS_INT128 -static_assert(std::__signed_integer<__int128_t>); -#endif -// Non-integer -static_assert(!std::__signed_integer<bool>); -static_assert(!std::__signed_integer<char>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__signed_integer<wchar_t>); -#endif -static_assert(!std::__signed_integer<char8_t>); -static_assert(!std::__signed_integer<char16_t>); -static_assert(!std::__signed_integer<char32_t>); -static_assert(!std::__signed_integer<float>); -static_assert(!std::__signed_integer<double>); -static_assert(!std::__signed_integer<long double>); -static_assert(!std::__signed_integer<void>); -static_assert(!std::__signed_integer<int*>); -static_assert(!std::__signed_integer<unsigned int*>); -static_assert(!std::__signed_integer<SomeObject>); -static_assert(!std::__signed_integer<SomeEnum>); -static_assert(!std::__signed_integer<SomeScopedEnum>); diff --git a/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_unsigned_integer.compile.pass.cpp b/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_unsigned_integer.compile.pass.cpp deleted file mode 100644 index ff60f32..0000000 --- a/libcxx/test/libcxx-03/concepts/concepts.arithmetic/__libcpp_unsigned_integer.compile.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Concept helpers for the internal type traits for the fundamental types. - -// template <class _Tp> -// concept __unsigned_integer; - -#include <__type_traits/integer_traits.h> - -#include "test_macros.h" - -struct SomeObject {}; - -enum SomeEnum {}; - -enum class SomeScopedEnum {}; - -// Unsigned -static_assert(std::__unsigned_integer<unsigned char>); -static_assert(std::__unsigned_integer<unsigned short int>); -static_assert(std::__unsigned_integer<unsigned int>); -static_assert(std::__unsigned_integer<unsigned long int>); -static_assert(std::__unsigned_integer<unsigned long long int>); -static_assert(std::__unsigned_integer<unsigned short int>); -#if _LIBCPP_HAS_INT128 -static_assert(std::__unsigned_integer<__uint128_t>); -#endif -// Signed -static_assert(!std::__unsigned_integer<signed char>); -static_assert(!std::__unsigned_integer<short int>); -static_assert(!std::__unsigned_integer<int>); -static_assert(!std::__unsigned_integer<long int>); -static_assert(!std::__unsigned_integer<long long int>); -static_assert(!std::__unsigned_integer<short int>); -#if _LIBCPP_HAS_INT128 -static_assert(!std::__unsigned_integer<__int128_t>); -#endif -// Non-integer -static_assert(!std::__unsigned_integer<bool>); -static_assert(!std::__unsigned_integer<char>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__unsigned_integer<wchar_t>); -#endif -static_assert(!std::__unsigned_integer<char8_t>); -static_assert(!std::__unsigned_integer<char16_t>); -static_assert(!std::__unsigned_integer<char32_t>); -static_assert(!std::__unsigned_integer<float>); -static_assert(!std::__unsigned_integer<double>); -static_assert(!std::__unsigned_integer<long double>); -static_assert(!std::__unsigned_integer<void>); -static_assert(!std::__unsigned_integer<int*>); -static_assert(!std::__unsigned_integer<unsigned int*>); -static_assert(!std::__unsigned_integer<SomeObject>); -static_assert(!std::__unsigned_integer<SomeEnum>); -static_assert(!std::__unsigned_integer<SomeScopedEnum>); diff --git a/libcxx/test/libcxx-03/containers/associative/non_const_comparator.incomplete.verify.cpp b/libcxx/test/libcxx-03/containers/associative/non_const_comparator.incomplete.verify.cpp deleted file mode 100644 index bae78ba..0000000 --- a/libcxx/test/libcxx-03/containers/associative/non_const_comparator.incomplete.verify.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Test that libc++ does not generate a warning diagnostic about the comparator -// too early for containers of incomplete types. -// -// See PR41360. - -#include <set> -#include <map> -#include <functional> - -template <template <typename...> class Container> -void test_set() { - struct KeyBase {}; - struct KeyDerived; // derives from KeyBase, but incomplete at this point - - // Name the type but don't instantiate it. - using C = Container<KeyDerived*, std::less<KeyBase*>>; - - // Instantiate it but don't ODR use any members. - typename C::value_type dummy; - (void)dummy; - - // Complete the types. - struct KeyDerived : KeyBase {}; - - C c; // ODR use it, which should be OK -} - -template <template <typename...> class Container> -void test_map() { - struct Value {}; - struct KeyBase {}; - struct KeyDerived; - using C = Container<KeyDerived*, Value, std::less<KeyBase*>>; - typename C::value_type dummy; - (void)dummy; - struct KeyDerived : KeyBase {}; - C c; -} - -void f() { - // expected-no-diagnostics - test_set<std::set>(); - test_set<std::multiset>(); - test_map<std::map>(); - test_map<std::multimap>(); -} diff --git a/libcxx/test/libcxx-03/containers/associative/non_const_comparator.verify.cpp b/libcxx/test/libcxx-03/containers/associative/non_const_comparator.verify.cpp deleted file mode 100644 index cb7a044..0000000 --- a/libcxx/test/libcxx-03/containers/associative/non_const_comparator.verify.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// REQUIRES: diagnose-if-support - -// Test that libc++ generates a warning diagnostic when the container is -// provided a non-const callable comparator. - -#include <__type_traits/invoke.h> -#include <map> -#include <set> - -struct BadCompare { - template <class T, class U> - bool operator()(T const& t, U const& u) { - return t < u; - } -}; - -void f() { - static_assert(!std::__is_invocable_v<BadCompare const&, int const&, int const&>, ""); - static_assert(std::__is_invocable_v<BadCompare&, int const&, int const&>, ""); - - // expected-warning@set:* 2 {{the specified comparator type does not provide a viable const call operator}} - // expected-warning@map:* 2 {{the specified comparator type does not provide a viable const call operator}} - { - using C = std::set<int, BadCompare>; - C s; - } - { - using C = std::multiset<long, BadCompare>; - C s; - } - { - using C = std::map<int, int, BadCompare>; - C s; - } - { - using C = std::multimap<long, int, BadCompare>; - C s; - } -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/assert.input_range.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/assert.input_range.pass.cpp deleted file mode 100644 index 2db803b..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/assert.input_range.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <flat_map> - -// flat_map(key_container_type , mapped_container_type , const key_compare& __comp = key_compare()) -// flat_map(const key_container_type& , const mapped_container_type& , const _Allocator& ) -// flat_map(const key_container_type& , const mapped_container_type& , const key_compare&, const _Allocator& ) -// void replace(key_container_type&& , mapped_container_type&&) -// - -#include <flat_map> -#include <functional> -#include <memory> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - using M = std::flat_map<int, int>; - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m({1, 2, 3}, {4}); }()), "flat_map keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m({1, 2, 3}, {4}, std::less<int>{}); }()), "flat_map keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{1, 2, 3}; - const std::vector values{4}; - const std::allocator<int> alloc{}; - M m(keys, values, alloc); - }()), - "flat_map keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{1, 2, 3}; - const std::vector values{4}; - const std::less<int> key_compare{}; - const std::allocator<int> alloc{}; - M m(keys, values, key_compare, alloc); - }()), - "flat_map keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{1, 2, 3}; - std::vector values{4}; - M m; - m.replace(std::move(keys), std::move(values)); - }()), - "flat_map keys and mapped containers have different size"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/assert.sorted_unique.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/assert.sorted_unique.pass.cpp deleted file mode 100644 index e6bd3f3..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/assert.sorted_unique.pass.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// REQUIRES: libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <flat_map> - -// flat_map(key_container_type , mapped_container_type , const key_compare& __comp = key_compare()) -// flat_map(const key_container_type& , const mapped_container_type& , const _Allocator& ) -// flat_map(const key_container_type& , const mapped_container_type& , const key_compare&, const _Allocator& ) -// void replace(key_container_type&& , mapped_container_type&&) -// - -#include <flat_map> -#include <functional> -#include <initializer_list> -#include <memory> -#include <utility> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - using M = std::flat_map<int, int>; - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {2, 2, 3}, {4, 5, 6}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {4, 2, 3}, {4, 5, 6}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {2, 2, 3}, {4, 5, 6}, std::less<int>{}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {4, 2, 3}, {4, 5, 6}, std::less<int>{}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{2, 2, 3}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, keys, values, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, keys, values, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{2, 2, 3}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_unique, keys, values, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_unique, keys, values, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - M m(std::sorted_unique, v.begin(), v.end(), comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - M m(std::sorted_unique, v.begin(), v.end(), comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - M m(std::sorted_unique, v, comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - M m(std::sorted_unique, v, comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - M m; - m.insert(std::sorted_unique, v.begin(), v.end()); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - M m; - m.insert(std::sorted_unique, v.begin(), v.end()); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {3, 6}}; - M m; - m.insert(std::sorted_unique, v); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - M m; - m.insert(std::sorted_unique, v); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{1, 1, 3}; - std::vector values{4, 5, 6}; - M m; - m.replace(std::move(keys), std::move(values)); - }()), - "Either the key container is not sorted or it contains duplicates"); - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/scary.compile.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/scary.compile.pass.cpp deleted file mode 100644 index 3fff89c..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.map/scary.compile.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_map> - -// class flat_map -// class flat_multimap - -// Extension: SCARY/N2913 iterator compatibility between flat_map and flat_multimap -// Test for the absence of this feature - -#include <flat_map> -#include <type_traits> - -#include "test_macros.h" - -void test() { - typedef std::flat_map<int, int> M1; - typedef std::flat_multimap<int, int> M2; - - static_assert(!std::is_convertible_v<M1::iterator, M2::iterator>); - static_assert(!std::is_convertible_v<M2::iterator, M1::iterator>); - - static_assert(!std::is_convertible_v<M1::const_iterator, M2::const_iterator>); - static_assert(!std::is_convertible_v<M2::const_iterator, M1::const_iterator>); -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multimap/assert.input_range.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.multimap/assert.input_range.pass.cpp deleted file mode 100644 index 504f36f..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multimap/assert.input_range.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <flat_map> - -// flat_multimap(key_container_type , mapped_container_type , const key_compare& __comp = key_compare()) -// flat_multimap(const key_container_type& , const mapped_container_type& , const _Allocator& ) -// flat_multimap(const key_container_type& , const mapped_container_type& , const key_compare&, const _Allocator& ) -// void replace(key_container_type&& , mapped_container_type&&) -// - -#include <flat_map> -#include <functional> -#include <memory> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - using M = std::flat_multimap<int, int>; - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m({1, 2, 3}, {4}); }()), "flat_multimap keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m({1, 2, 3}, {4}, std::less<int>{}); }()), - "flat_multimap keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{1, 2, 3}; - const std::vector values{4}; - const std::allocator<int> alloc{}; - M m(keys, values, alloc); - }()), - "flat_multimap keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{1, 2, 3}; - const std::vector values{4}; - const std::less<int> key_compare{}; - const std::allocator<int> alloc{}; - M m(keys, values, key_compare, alloc); - }()), - "flat_multimap keys and mapped containers have different size"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{1, 2, 3}; - std::vector values{4}; - M m; - m.replace(std::move(keys), std::move(values)); - }()), - "flat_multimap keys and mapped containers have different size"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multimap/assert.sorted_equivalent.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.multimap/assert.sorted_equivalent.pass.cpp deleted file mode 100644 index 6b8ad3c..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multimap/assert.sorted_equivalent.pass.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// REQUIRES: libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <flat_map> - -// flat_multimap(key_container_type , mapped_container_type , const key_compare& __comp = key_compare()) -// flat_multimap(const key_container_type& , const mapped_container_type& , const _Allocator& ) -// flat_multimap(const key_container_type& , const mapped_container_type& , const key_compare&, const _Allocator& ) -// void replace(key_container_type&& , mapped_container_type&&) -// - -#include <flat_map> -#include <functional> -#include <initializer_list> -#include <memory> -#include <utility> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - using M = std::flat_multimap<int, int>; - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m(std::sorted_equivalent, {2, 2, 1}, {4, 5, 6}); }()), "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m(std::sorted_equivalent, {4, 2, 3}, {4, 5, 6}); }()), "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m(std::sorted_equivalent, {2, 2, 1}, {4, 5, 6}, std::less<int>{}); }()), "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m(std::sorted_equivalent, {4, 2, 3}, {4, 5, 6}, std::less<int>{}); }()), "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{2, 2, 1}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, keys, values, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, keys, values, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{2, 2, 1}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, keys, values, comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::vector values{4, 5, 6}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, keys, values, comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, v.begin(), v.end(), comp); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, v.begin(), v.end(), comp); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v.begin(), v.end(), comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v.begin(), v.end(), comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v.begin(), v.end(), alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v.begin(), v.end(), alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, v, comp); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, v, comp); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v, comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v, comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - M m; - m.insert(std::sorted_equivalent, v.begin(), v.end()); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - M m; - m.insert(std::sorted_equivalent, v.begin(), v.end()); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{2, 4}, {2, 5}, {1, 6}}; - M m; - m.insert(std::sorted_equivalent, v); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<std::pair<int, int>> v{{4, 4}, {2, 5}, {3, 6}}; - M m; - m.insert(std::sorted_equivalent, v); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{2, 1, 3}; - std::vector values{4, 5, 6}; - M m; - m.replace(std::move(keys), std::move(values)); - }()), - "Key container is not sorted"); - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/assert.sorted_unique.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/assert.sorted_unique.pass.cpp deleted file mode 100644 index 54b07ba..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/assert.sorted_unique.pass.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// REQUIRES: libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <flat_set> - -// flat_multiset(container_type , const key_compare& __comp = key_compare()) -// flat_multiset(const container_type& , const _Allocator& ) -// flat_multiset(const container_type& , const key_compare&, const _Allocator& ) -// void replace(container_type&& ) -// - -#include <flat_set> -#include <functional> -#include <initializer_list> -#include <memory> -#include <utility> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - using M = std::flat_multiset<int>; - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_equivalent, {4, 2, 3}); }()), "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { M m(std::sorted_equivalent, {4, 2, 3}, std::less<int>{}); }()), "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, keys, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, keys, comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, v.begin(), v.end(), comp); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v.begin(), v.end(), comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v.begin(), v.end(), alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - const std::less<int> comp{}; - M m(std::sorted_equivalent, v, comp); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v, comp, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_equivalent, v, alloc); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - M m; - m.insert(std::sorted_equivalent, v.begin(), v.end()); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - M m; - m.insert(std::sorted_equivalent, v); - }()), - "Key container is not sorted"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{2, 1, 3}; - M m; - m.replace(std::move(keys)); - }()), - "Key container is not sorted"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/insert.temporary.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/insert.temporary.pass.cpp deleted file mode 100644 index c185d0c..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/insert.temporary.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// https://github.com/llvm/llvm-project/issues/119016 - -#include <flat_set> - -#include <cassert> -#include <utility> -#include <vector> - -#include "../flat_helpers.h" -#include "test_macros.h" - -bool test() { - using M = std::flat_multiset<TrackCopyMove>; - { - M m; - TrackCopyMove t; - m.insert(t); - assert(m.begin()->copy_count == 1); - assert(m.begin()->move_count == 0); - } - { - M m; - TrackCopyMove t; - m.emplace(t); - assert(m.begin()->copy_count == 1); - assert(m.begin()->move_count == 0); - } - - return true; -} - -int main(int, char**) { - test(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/insert_range.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/insert_range.pass.cpp deleted file mode 100644 index d69b05a..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/insert_range.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-localization - -// <flat_set> - -// As an extension, libc++ flat containers support inserting a non forward range into -// a pre-C++23 container that doesn't provide insert_range(...), since many containers -// out there are in that situation. -// https://github.com/llvm/llvm-project/issues/136656 - -#include <algorithm> -#include <cassert> -#include <flat_set> -#include <ranges> -#include <sstream> -#include <vector> - -#include "../flat_helpers.h" -#include "test_macros.h" - -void test() { - NotQuiteSequenceContainer<int> v; - std::flat_multiset s(v); - std::istringstream ints("0 1 1 0"); - auto r = std::ranges::subrange(std::istream_iterator<int>(ints), std::istream_iterator<int>()) | - std::views::transform([](int i) { return i * i; }); - static_assert( -  { return requires { t.insert_range(t.end(), r); }; }(v), - "This test is to test the case where the underlying container does not provide insert_range"); - s.insert_range(r); - assert(std::ranges::equal(s, std::vector<int>{0, 0, 1, 1})); -} - -int main(int, char**) { - test(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/iterator.compile.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/iterator.compile.pass.cpp deleted file mode 100644 index 0954e42..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.multiset/iterator.compile.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// test that iterators from different types of flat_multiset are not compatible - -#include <deque> -#include <functional> -#include <flat_set> -#include <type_traits> - -using Iter1 = std::flat_multiset<int>::iterator; -using Iter2 = std::flat_multiset<double>::iterator; -using Iter3 = std::flat_multiset<int, std::greater<>>::iterator; -using Iter4 = std::flat_multiset<int, std::less<int>, std::deque<int>>::iterator; - -static_assert(std::is_convertible_v<Iter1, Iter1>); -static_assert(!std::is_convertible_v<Iter1, Iter2>); -static_assert(!std::is_convertible_v<Iter1, Iter3>); -static_assert(!std::is_convertible_v<Iter1, Iter4>); - -static_assert(!std::is_convertible_v<Iter2, Iter1>); -static_assert(std::is_convertible_v<Iter2, Iter2>); -static_assert(!std::is_convertible_v<Iter2, Iter3>); -static_assert(!std::is_convertible_v<Iter2, Iter4>); - -static_assert(!std::is_convertible_v<Iter3, Iter1>); -static_assert(!std::is_convertible_v<Iter3, Iter2>); -static_assert(std::is_convertible_v<Iter3, Iter3>); -static_assert(!std::is_convertible_v<Iter3, Iter4>); - -static_assert(!std::is_convertible_v<Iter4, Iter1>); -static_assert(!std::is_convertible_v<Iter4, Iter2>); -static_assert(!std::is_convertible_v<Iter4, Iter3>); -static_assert(std::is_convertible_v<Iter4, Iter4>); diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/assert.sorted_unique.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/assert.sorted_unique.pass.cpp deleted file mode 100644 index 62903af..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/assert.sorted_unique.pass.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// REQUIRES: libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <flat_set> - -// flat_set(container_type , const key_compare& __comp = key_compare()) -// flat_set(const container_type& , const _Allocator& ) -// flat_set(const container_type& , const key_compare&, const _Allocator& ) -// void replace(container_type&& ) -// - -#include <flat_set> -#include <functional> -#include <initializer_list> -#include <memory> -#include <utility> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - using M = std::flat_set<int>; - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {2, 2, 3}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {4, 2, 3}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {2, 2, 3}, std::less<int>{}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE(([] { M m(std::sorted_unique, {4, 2, 3}, std::less<int>{}); }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{2, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, keys, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, keys, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{2, 2, 3}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_unique, keys, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector keys{4, 2, 3}; - const std::allocator<int> alloc{}; - const std::less<int> comp{}; - M m(std::sorted_unique, keys, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{2, 2, 3}; - const std::less<int> comp{}; - M m(std::sorted_unique, v.begin(), v.end(), comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - const std::less<int> comp{}; - M m(std::sorted_unique, v.begin(), v.end(), comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{2, 2, 3}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{2, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v.begin(), v.end(), alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{2, 2, 3}; - const std::less<int> comp{}; - M m(std::sorted_unique, v, comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - const std::less<int> comp{}; - M m(std::sorted_unique, v, comp); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{2, 2, 3}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - const std::less<int> comp{}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, comp, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{2, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - const std::allocator<int> alloc{}; - M m(std::sorted_unique, v, alloc); - }()), - "Either the key container is not sorted or it contains duplicates"); - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{2, 2, 3}; - M m; - m.insert(std::sorted_unique, v.begin(), v.end()); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - const std::vector<int> v{4, 2, 3}; - M m; - m.insert(std::sorted_unique, v.begin(), v.end()); - }()), - "Either the key container is not sorted or it contains duplicates"); - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{2, 2, 3}; - M m; - m.insert(std::sorted_unique, v); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::initializer_list<int> v{4, 2, 3}; - M m; - m.insert(std::sorted_unique, v); - }()), - "Either the key container is not sorted or it contains duplicates"); - - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{1, 1, 3}; - M m; - m.replace(std::move(keys)); - }()), - "Either the key container is not sorted or it contains duplicates"); - TEST_LIBCPP_ASSERT_FAILURE( - ([] { - std::vector keys{2, 1, 3}; - M m; - m.replace(std::move(keys)); - }()), - "Either the key container is not sorted or it contains duplicates"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/insert.temporary.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/insert.temporary.pass.cpp deleted file mode 100644 index e71f351..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/insert.temporary.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// https://github.com/llvm/llvm-project/issues/119016 - -#include <flat_set> - -#include <cassert> -#include <utility> -#include <vector> - -#include "../flat_helpers.h" -#include "test_macros.h" - -bool test() { - using M = std::flat_set<TrackCopyMove>; - { - M m; - TrackCopyMove t; - m.insert(t); - assert(m.begin()->copy_count == 1); - assert(m.begin()->move_count == 0); - } - { - M m; - TrackCopyMove t; - m.emplace(t); - assert(m.begin()->copy_count == 1); - assert(m.begin()->move_count == 0); - } - - return true; -} - -int main(int, char**) { - test(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/insert_range.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/insert_range.pass.cpp deleted file mode 100644 index 35b9737..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/insert_range.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-localization - -// <flat_set> - -// As an extension, libc++ flat containers support inserting a non forward range into -// a pre-C++23 container that doesn't provide insert_range(...), since many containers -// out there are in that situation. -// https://github.com/llvm/llvm-project/issues/136656 - -#include <algorithm> -#include <cassert> -#include <flat_set> -#include <ranges> -#include <sstream> -#include <vector> - -#include "../flat_helpers.h" -#include "test_macros.h" - -void test() { - NotQuiteSequenceContainer<int> v; - std::flat_set s(v); - std::istringstream ints("0 1 1 0"); - auto r = std::ranges::subrange(std::istream_iterator<int>(ints), std::istream_iterator<int>()) | - std::views::transform([](int i) { return i * i; }); - static_assert( -  { return requires { t.insert_range(t.end(), r); }; }(v), - "This test is to test the case where the underlying container does not provide insert_range"); - s.insert_range(r); - assert(std::ranges::equal(s, std::vector<int>{0, 1})); -} - -int main(int, char**) { - test(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/iterator.compile.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/iterator.compile.pass.cpp deleted file mode 100644 index f2b3f1a..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/iterator.compile.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// test that iterators from different types of flat_set are not compatible - -#include <deque> -#include <functional> -#include <flat_set> -#include <type_traits> - -using Iter1 = std::flat_set<int>::iterator; -using Iter2 = std::flat_set<double>::iterator; -using Iter3 = std::flat_set<int, std::greater<>>::iterator; -using Iter4 = std::flat_set<int, std::less<int>, std::deque<int>>::iterator; - -static_assert(std::is_convertible_v<Iter1, Iter1>); -static_assert(!std::is_convertible_v<Iter1, Iter2>); -static_assert(!std::is_convertible_v<Iter1, Iter3>); -static_assert(!std::is_convertible_v<Iter1, Iter4>); - -static_assert(!std::is_convertible_v<Iter2, Iter1>); -static_assert(std::is_convertible_v<Iter2, Iter2>); -static_assert(!std::is_convertible_v<Iter2, Iter3>); -static_assert(!std::is_convertible_v<Iter2, Iter4>); - -static_assert(!std::is_convertible_v<Iter3, Iter1>); -static_assert(!std::is_convertible_v<Iter3, Iter2>); -static_assert(std::is_convertible_v<Iter3, Iter3>); -static_assert(!std::is_convertible_v<Iter3, Iter4>); - -static_assert(!std::is_convertible_v<Iter4, Iter1>); -static_assert(!std::is_convertible_v<Iter4, Iter2>); -static_assert(!std::is_convertible_v<Iter4, Iter3>); -static_assert(std::is_convertible_v<Iter4, Iter4>); diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/scary.compile.pass.cpp b/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/scary.compile.pass.cpp deleted file mode 100644 index 99e93fc..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat.set/scary.compile.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// class flat_set -// class flat_multiset - -// Extension: SCARY/N2913 iterator compatibility between flat_set and flat_multiset -// Test for the absence of this feature - -#include <flat_set> -#include <type_traits> - -#include "test_macros.h" - -void test() { - typedef std::flat_set<int, int> M1; - typedef std::flat_multiset<int, int> M2; - - static_assert(!std::is_convertible_v<M1::iterator, M2::iterator>); - static_assert(!std::is_convertible_v<M2::iterator, M1::iterator>); - - static_assert(!std::is_convertible_v<M1::const_iterator, M2::const_iterator>); - static_assert(!std::is_convertible_v<M2::const_iterator, M1::const_iterator>); -} diff --git a/libcxx/test/libcxx-03/containers/container.adaptors/flat_helpers.h b/libcxx/test/libcxx-03/containers/container.adaptors/flat_helpers.h deleted file mode 100644 index cc59f59..0000000 --- a/libcxx/test/libcxx-03/containers/container.adaptors/flat_helpers.h +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_CONTAINERS_CONTAINER_ADAPTORS_FLAT_HELPERS_H -#define TEST_LIBCXX_CONTAINERS_CONTAINER_ADAPTORS_FLAT_HELPERS_H - -#include <vector> - -struct TrackCopyMove { - mutable int copy_count = 0; - int move_count = 0; - - constexpr TrackCopyMove() = default; - constexpr TrackCopyMove(const TrackCopyMove& other) : copy_count(other.copy_count), move_count(other.move_count) { - ++copy_count; - ++other.copy_count; - } - - constexpr TrackCopyMove(TrackCopyMove&& other) noexcept : copy_count(other.copy_count), move_count(other.move_count) { - ++move_count; - ++other.move_count; - } - constexpr TrackCopyMove& operator=(const TrackCopyMove& other) { - ++copy_count; - ++other.copy_count; - return *this; - } - constexpr TrackCopyMove& operator=(TrackCopyMove&& other) noexcept { - ++move_count; - ++other.move_count; - return *this; - } - constexpr bool operator==(const TrackCopyMove&) const { return true; } - constexpr bool operator<(const TrackCopyMove&) const { return false; } -}; - -template <class T> -struct NotQuiteSequenceContainer : std::vector<T> { - // hide the name insert_range - void insert_range() = delete; -}; - -#endif // TEST_LIBCXX_CONTAINERS_CONTAINER_ADAPTORS_FLAT_HELPERS_H diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp deleted file mode 100644 index 1701b89..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <deque> - -// Regression test to error in deque::__annotate_from_to in deque, -// with origin in deque::__add_back_capacity. - -// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support. -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-localization - -#include <deque> -#include <cstdio> -#include "check_assertion.h" - -void test1() { - std::deque<char> test; - char buff[100000]; - test.insert(test.begin(), buff, buff + 64000); - - for (int i = 0; i < 1100; i += 1) { - test.insert(test.begin(), buff, buff + 320); - test.erase(test.end() - 320, test.end()); - } - - test.insert(test.begin(), buff, buff + 32000); -} - -void test2() { - std::deque<char> test; - char buff[100000]; - test.insert(test.end(), buff, buff + 64000); - - for (int i = 0; i < 1100; i += 1) { - test.insert(test.end(), buff, buff + 320); - test.erase(test.begin(), test.begin() + 320); - } - - test.insert(test.end(), buff, buff + 32000); -} - -int main(int, char**) { - test1(); - test2(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/asan_turning_off.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/asan_turning_off.pass.cpp deleted file mode 100644 index b31775a..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/deque/asan_turning_off.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <deque> - -// Test based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1419798#c5 -// Some allocators during deallocation may not call destructors and just reuse memory. -// In those situations, one may want to deactivate annotations for a specific allocator. -// It's possible with __asan_annotate_container_with_allocator template class. -// This test confirms that those allocators work after turning off annotations. - -#include <cassert> -#include <cstddef> -#include <deque> -#include <new> - -struct reuse_allocator { - static size_t const N = 100; - reuse_allocator() { - for (size_t i = 0; i < N; ++i) - __buffers[i] = new char[8 * 1024]; - } - ~reuse_allocator() { - for (size_t i = 0; i < N; ++i) - delete[] (char*)__buffers[i]; - } - void* alloc() { - assert(__next_id < N); - return __buffers[__next_id++]; - } - void reset() { __next_id = 0; } - void* __buffers[N]; - size_t __next_id = 0; -} reuse_buffers; - -template <typename T> -struct user_allocator { - using value_type = T; - user_allocator() = default; - template <class U> - user_allocator(user_allocator<U>) {} - friend bool operator==(user_allocator, user_allocator) { return true; } - friend bool operator!=(user_allocator x, user_allocator y) { return !(x == y); } - - T* allocate(size_t) { return (T*)reuse_buffers.alloc(); } - void deallocate(T*, size_t) noexcept {} -}; - -#ifdef _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS -template <class T> -struct std::__asan_annotate_container_with_allocator<user_allocator<T>> : false_type {}; -#endif - -int main(int, char**) { - using D = std::deque<int, user_allocator<int>>; - - { - D* d = new (reuse_buffers.alloc()) D(); - for (int i = 0; i < 100; i++) - d->push_back(i); - } - reuse_buffers.reset(); - { - D d; - for (int i = 0; i < 1000; i++) - d.push_back(i); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/assert.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/assert.pass.cpp deleted file mode 100644 index 375a4cd..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/deque/assert.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <deque> - -// Test hardening assertions for std::deque. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <deque> - -#include "check_assertion.h" - -int main(int, char**) { - std::deque<int> c; - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "deque::front called on an empty deque"); - TEST_LIBCPP_ASSERT_FAILURE(c.back(), "deque::back called on an empty deque"); - TEST_LIBCPP_ASSERT_FAILURE(c[0], "deque::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(c.pop_front(), "deque::pop_front called on an empty deque"); - TEST_LIBCPP_ASSERT_FAILURE(c.pop_back(), "deque::pop_back called on an empty deque"); - - // Repeat the test with a const reference to test the const overloads. - { - const std::deque<int>& cc = c; - TEST_LIBCPP_ASSERT_FAILURE(cc.front(), "deque::front called on an empty deque"); - TEST_LIBCPP_ASSERT_FAILURE(cc.back(), "deque::back called on an empty deque"); - TEST_LIBCPP_ASSERT_FAILURE(cc[0], "deque::operator[] index out of bounds"); - } - - c.push_back(1); - c.push_back(2); - c.push_back(3); - TEST_LIBCPP_ASSERT_FAILURE(c[3], "deque::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(c[100], "deque::operator[] index out of bounds"); - - // Repeat the test with a const reference to test the const overloads. - { - const std::deque<int>& cc = c; - TEST_LIBCPP_ASSERT_FAILURE(cc[3], "deque::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(cc[100], "deque::operator[] index out of bounds"); - } - - TEST_LIBCPP_ASSERT_FAILURE(c.erase(c.end()), "deque::erase(iterator) called with a non-dereferenceable iterator"); - TEST_LIBCPP_ASSERT_FAILURE( - c.erase(c.begin() + 1, c.begin()), "deque::erase(first, last) called with an invalid range"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/assert.pop_back.empty.pass.cpp deleted file mode 100644 index 6bdb117..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/deque/assert.pop_back.empty.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <deque> - -// pop_back() more than the number of elements in a deque - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <deque> - -#include "check_assertion.h" - -int main(int, char**) { - std::deque<int> q; - q.push_back(0); - q.pop_back(); - TEST_LIBCPP_ASSERT_FAILURE(q.pop_back(), "deque::pop_back called on an empty deque"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/spare_block_handling.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/spare_block_handling.pass.cpp deleted file mode 100644 index 4fa4982..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/deque/spare_block_handling.pass.cpp +++ /dev/null @@ -1,288 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <deque> - -// Test how deque manages the spare blocks it keeps. The exact values it tests -// for are not always important, but are sometimes needed to ensure the container -// resizes or shrinks at the correct time. - -#include <deque> -#include <cassert> -#include <cstdio> -#include <memory> -#include <queue> -#include <stack> -#include <string> - -#include "min_allocator.h" -#include "assert_macros.h" - -template <class Adaptor> -struct ContainerAdaptor : public Adaptor { - using Adaptor::Adaptor; - typename Adaptor::container_type& GetContainer() { return Adaptor::c; } -}; - -template <class Deque> -static void print(const Deque& d) { - std::printf( - "%zu : __front_spare() == %zu" - " : __back_spare() == %zu" - " : __capacity() == %zu" - " : bytes allocated == %zu\n", - d.size(), - d.__front_spare(), - d.__back_spare(), - d.__capacity(), - malloc_allocator_base::outstanding_bytes); -} - -template <class T> -using Deque = std::deque<T, malloc_allocator<T> >; - -template <class T> -using BlockSize = std::__deque_block_size<T, std::ptrdiff_t>; - -struct LargeT { - LargeT() = default; - char buff[256] = {}; -}; -static_assert(BlockSize<LargeT>::value == 16, ""); - -const auto& AllocBytes = malloc_allocator_base::outstanding_bytes; - -template <class Deque> -struct PrintOnFailure { - explicit PrintOnFailure(Deque const& deque) : deque_(&deque) {} - void operator()() const { print(*deque_); } - -private: - const Deque* deque_; - - PrintOnFailure(PrintOnFailure const&) = delete; -}; - -static void push_back() { - const auto BS = BlockSize<LargeT>::value; - std::unique_ptr<Deque<LargeT>> dp(new Deque<LargeT>); - auto& d = *dp; - PrintOnFailure<Deque<LargeT>> on_fail(d); - - // Test nothing is allocated after default construction. - { - TEST_REQUIRE(d.size() == 0, on_fail); - TEST_REQUIRE(d.__capacity() == 0, on_fail); - TEST_REQUIRE(d.__block_count() == 0, on_fail); - } - // First push back allocates one block. - d.push_back({}); - { - TEST_REQUIRE(d.size() == 1, on_fail); - TEST_REQUIRE(d.__front_spare() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 14, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__capacity() == BS - 1, on_fail); - TEST_REQUIRE(d.__block_count() == 1, on_fail); - } - - d.push_back({}); - { - TEST_REQUIRE(d.size() == 2, on_fail); - TEST_REQUIRE(d.__front_spare() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 13, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - } - // Push back until we need a new block. - for (int RemainingCap = d.__capacity() - d.size(); RemainingCap >= 0; --RemainingCap) - d.push_back({}); - { - TEST_REQUIRE(d.__block_count() == 2, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 15, on_fail); - } - - // Remove the only element in the new block. Test that we keep the empty - // block as a spare. - d.pop_back(); - { - TEST_REQUIRE(d.__block_count() == 2, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 1, on_fail); - TEST_REQUIRE(d.__back_spare() == 16, on_fail); - } - - // Pop back again, keep the spare. - d.pop_back(); - { - TEST_REQUIRE(d.__block_count() == 2, on_fail); - TEST_REQUIRE(d.__front_spare() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 17, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 1, on_fail); - } - - dp.reset(); - TEST_REQUIRE(AllocBytes == 0, on_fail); -} - -static void push_front() { - std::unique_ptr<Deque<LargeT>> dp(new Deque<LargeT>); - auto& d = *dp; - PrintOnFailure<Deque<LargeT>> on_fail(d); - - // Test nothing is allocated after default construction. - { - TEST_REQUIRE(d.size() == 0, on_fail); - TEST_REQUIRE(d.__capacity() == 0, on_fail); - TEST_REQUIRE(d.__block_count() == 0, on_fail); - } - // First push front allocates one block, and we start the sequence in the - // middle. - d.push_front({}); - { - TEST_REQUIRE(d.size() == 1, on_fail); - TEST_REQUIRE(d.__front_spare() == 7, on_fail); - TEST_REQUIRE(d.__back_spare() == 7, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__block_count() == 1, on_fail); - } - - d.push_front({}); - { - TEST_REQUIRE(d.size() == 2, on_fail); - TEST_REQUIRE(d.__front_spare() == 6, on_fail); - TEST_REQUIRE(d.__back_spare() == 7, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - } - // Push front until we need a new block. - for (int RemainingCap = d.__front_spare(); RemainingCap >= 0; --RemainingCap) - d.push_front({}); - { - TEST_REQUIRE(d.__block_count() == 2, on_fail); - TEST_REQUIRE(d.__front_spare() == 15, on_fail); - TEST_REQUIRE(d.__back_spare() == 7, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - } - - // Remove the only element in the new block. Test that we keep the empty - // block as a spare. - d.pop_front(); - { - TEST_REQUIRE(d.__block_count() == 2, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 1, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 7, on_fail); - } - - // Pop back again, keep the spare. - d.pop_front(); - { - TEST_REQUIRE(d.__block_count() == 2, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 1, on_fail); - TEST_REQUIRE(d.__back_spare() == 7, on_fail); - } - - dp.reset(); - TEST_REQUIRE(AllocBytes == 0, on_fail); -} - -static void std_queue() { - using D = Deque<LargeT>; - using Queue = std::queue<LargeT, D>; - ContainerAdaptor<Queue> CA; - const D& d = CA.GetContainer(); - Queue& q = CA; - PrintOnFailure<Deque<LargeT>> on_fail(d); - - while (d.__block_count() < 4) - q.push({}); - { - TEST_REQUIRE(d.__block_count() == 4, on_fail); - TEST_REQUIRE(d.__front_spare() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 15, on_fail); - TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail); - } - while (d.__back_spare()) { - q.push({}); - } - { - TEST_REQUIRE(d.__block_count() == 4, on_fail); - TEST_REQUIRE(d.__front_spare() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 0, on_fail); - } - q.pop(); - { - TEST_REQUIRE(d.__block_count() == 4, on_fail); - TEST_REQUIRE(d.__front_spare() == 1, on_fail); - TEST_REQUIRE(d.__back_spare() == 0, on_fail); - } - - // Pop until we create a spare block at the front. - while (d.__front_spare() <= 15) - q.pop(); - - { - TEST_REQUIRE(d.__block_count() == 4, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 1, on_fail); - TEST_REQUIRE(d.__front_spare() == 16, on_fail); - TEST_REQUIRE(d.__back_spare() == 0, on_fail); - } - - // Push at the end -- should re-use new spare block at front - q.push({}); - - { - TEST_REQUIRE(d.__block_count() == 4, on_fail); - TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail); - TEST_REQUIRE(d.__front_spare() == 0, on_fail); - TEST_REQUIRE(d.__back_spare() == 15, on_fail); - } - while (!q.empty()) { - q.pop(); - TEST_REQUIRE(d.__front_spare_blocks() + d.__back_spare_blocks() <= 2, on_fail); - } - - // The empty state has two blocks - { - TEST_REQUIRE(d.__front_spare() == 16, on_fail); - TEST_REQUIRE(d.__back_spare() == 15, on_fail); - TEST_REQUIRE(d.__capacity() == 31, on_fail); - } -} - -static void pop_front_push_back() { - Deque<char> d(32 * 1024, 'a'); - bool take_from_front = true; - while (d.size() > 0) { - if (take_from_front) { - d.pop_front(); - take_from_front = false; - } else { - d.pop_back(); - take_from_front = true; - } - if (d.size() % 1000 == 0 || d.size() < 50) { - print(d); - } - } -} - -int main(int, char**) { - push_back(); - push_front(); - std_queue(); - pop_front_push_back(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/forwardlist/assert.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/forwardlist/assert.pass.cpp deleted file mode 100644 index 6d1748e..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/forwardlist/assert.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <forward_list> - -// Test hardening assertions for std::forward_list. - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <forward_list> - -#include "check_assertion.h" - -int main(int, char**) { - { // Default-constructed list. - std::forward_list<int> c; - const auto& const_c = c; - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "forward_list::front called on an empty list"); - TEST_LIBCPP_ASSERT_FAILURE(const_c.front(), "forward_list::front called on an empty list"); - TEST_LIBCPP_ASSERT_FAILURE(c.pop_front(), "forward_list::pop_front called on an empty list"); - } - - { // Non-empty list becomes empty. - std::forward_list<int> c; - const auto& const_c = c; - c.push_front(1); - - // Check that there's no assertion on valid access. - (void)c.front(); - (void)const_c.front(); - - c.pop_front(); - TEST_LIBCPP_ASSERT_FAILURE(c.pop_front(), "forward_list::pop_front called on an empty list"); - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "forward_list::front called on an empty list"); - TEST_LIBCPP_ASSERT_FAILURE(const_c.front(), "forward_list::front called on an empty list"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp deleted file mode 100644 index 237b0f1..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 - -// <forward_list> - -// This test shows the effect of implementing `LWG4135`, before it this code -// was ill-formed, as the predicate is not bool. `LWG4135` suggests that -// std::erase explicitly specifying the lambda's return type as bool. - -#include <forward_list> - -struct Bool { - Bool() = default; - Bool(const Bool&) = delete; - operator bool() const { return true; } -}; - -struct Int { - Bool& operator==(Int) const { - static Bool b; - return b; - } -}; - -int main(int, char**) { - std::forward_list<Int> l; - std::erase(l, Int{}); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.cons/debug.copy.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.cons/debug.copy.pass.cpp deleted file mode 100644 index 144a696..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.cons/debug.copy.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// list(list&& c); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> l1; - l1.push_back(1); - l1.push_back(2); - l1.push_back(3); - std::list<int>::iterator i = l1.begin(); - std::list<int> l2 = l1; - TEST_LIBCPP_ASSERT_FAILURE(l2.erase(i), "list::erase(iterator) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp deleted file mode 100644 index 6441d53..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// Call erase(const_iterator position) with end() - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - int a1[] = {1, 2, 3}; - std::list<int> l1(a1, a1 + 3); - std::list<int>::const_iterator i = l1.end(); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with a non-dereferenceable iterator"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp deleted file mode 100644 index c344264..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// void pop_back(); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <list> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - int a[] = {1, 2, 3}; - std::list<int> c(a, a + 3); - c.pop_back(); - assert(c == std::list<int>(a, a + 2)); - c.pop_back(); - assert(c == std::list<int>(a, a + 1)); - c.pop_back(); - assert(c.empty()); - TEST_LIBCPP_ASSERT_FAILURE(c.pop_back(), "list::pop_back() called on an empty list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/bool-conversion.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/bool-conversion.pass.cpp deleted file mode 100644 index 59083b8..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/bool-conversion.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 - -// <list> - -// This test shows the effect of implementing `LWG4135`, before it this code -// was ill-formed, as the predicate is not bool. `LWG4135` suggests that -// std::erase explicitly specifying the lambda's return type as bool. - -#include <list> - -struct Bool { - Bool() = default; - Bool(const Bool&) = delete; - operator bool() const { return true; } -}; - -struct Int { - Bool& operator==(Int) const { - static Bool b; - return b; - } -}; - -int main(int, char**) { - std::list<Int> l; - std::erase(l, Int{}); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp deleted file mode 100644 index cd2f1ee..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// template <class... Args> void emplace(const_iterator p, Args&&... args); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -struct A { - explicit A(int i, double d) { - (void)i; - (void)d; - } -}; - -int main(int, char**) { - std::list<A> c1; - std::list<A> c2; - TEST_LIBCPP_ASSERT_FAILURE(c1.emplace(c2.cbegin(), 2, 3.5), - "list::emplace(iterator, args...) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp deleted file mode 100644 index fb61673..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// Call erase(const_iterator position) with iterator from another container - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - int a1[] = {1, 2, 3}; - std::list<int> l1(a1, a1 + 3); - std::list<int> l2(a1, a1 + 3); - std::list<int>::const_iterator i = l2.begin(); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp deleted file mode 100644 index 9d4198a..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// Call erase(const_iterator first, const_iterator last); with various invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - // First iterator from another container - { - int a1[] = {1, 2, 3}; - std::list<int> l1(a1, a1 + 3); - std::list<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l1.cbegin())), - "list::erase(iterator, iterator) called with an iterator not referring to this list"); - } - - // Second iterator from another container - { - int a1[] = {1, 2, 3}; - std::list<int> l1(a1, a1 + 3); - std::list<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), std::next(l2.cbegin())), - "list::erase(iterator, iterator) called with an iterator not referring to this list"); - } - - // Both iterators from another container - { - int a1[] = {1, 2, 3}; - std::list<int> l1(a1, a1 + 3); - std::list<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l2.cbegin())), - "list::erase(iterator, iterator) called with an iterator not referring to this list"); - } - - // With an invalid range - { - int a1[] = {1, 2, 3}; - std::list<int> l1(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()), - "Attempted to increment a non-incrementable list::const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp deleted file mode 100644 index 13326a1..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// template <InputIterator Iter> -// iterator insert(const_iterator position, Iter first, Iter last); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> v(100); - std::list<int> v2(100); - int a[] = {1, 2, 3, 4, 5}; - TEST_LIBCPP_ASSERT_FAILURE(v.insert(v2.cbegin(), a, a + 5), - "list::insert(iterator, range) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp deleted file mode 100644 index f4bce9a..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// iterator insert(const_iterator position, value_type&& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> v1(3); - std::list<int> v2(3); - TEST_LIBCPP_ASSERT_FAILURE( - v1.insert(v2.begin(), 4), "list::insert(iterator, x) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp deleted file mode 100644 index 46bad61..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// iterator insert(const_iterator position, size_type n, const value_type& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> c1(100); - std::list<int> c2; - TEST_LIBCPP_ASSERT_FAILURE( - c1.insert(c2.cbegin(), 5, 1), "list::insert(iterator, n, x) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp deleted file mode 100644 index 16fa8ef..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// iterator insert(const_iterator position, const value_type& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> v1(3); - std::list<int> v2(3); - int i = 4; - TEST_LIBCPP_ASSERT_FAILURE( - v1.insert(v2.begin(), i), "list::insert(iterator, x) called with an iterator not referring to this list"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp deleted file mode 100644 index be759d0..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// void splice(const_iterator position, list& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> v1(3); - std::list<int> v2(3); - TEST_LIBCPP_ASSERT_FAILURE( - v1.splice(v2.begin(), v2), "list::splice(iterator, list) called with an iterator not referring to this list"); - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp deleted file mode 100644 index 1786a6c..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// void splice(const_iterator position, list<T,Allocator>& x, iterator i); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> v1(3); - std::list<int> v2(3); - TEST_LIBCPP_ASSERT_FAILURE( - v1.splice(v1.begin(), v2, v1.begin()), - "list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp deleted file mode 100644 index b7c869f..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/list/list.ops/debug.splice.pos_list_iter_iter.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <list> - -// void splice(const_iterator position, list& x, iterator first, iterator last); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <list> - -#include "check_assertion.h" - -int main(int, char**) { - std::list<int> v1(3); - std::list<int> v2(3); - TEST_LIBCPP_ASSERT_FAILURE( - v1.splice(v1.begin(), v2, v2.begin(), v1.end()), - "list::splice(iterator, list, iterator, iterator) called with third iterator not referring to the list argument"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector.bool/assert.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector.bool/assert.pass.cpp deleted file mode 100644 index 41badad..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector.bool/assert.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Test hardening assertions for std::vector<bool>. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class Allocator> -void test() { - std::vector<bool, Allocator> c; - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "vector<bool>::front() called on an empty vector"); - TEST_LIBCPP_ASSERT_FAILURE(c.back(), "vector<bool>::back() called on an empty vector"); - TEST_LIBCPP_ASSERT_FAILURE(c[0], "vector<bool>::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(c.pop_back(), "vector<bool>::pop_back called on an empty vector"); - - // Repeat the test with a const reference to test the const overloads. - { - const std::vector<bool, Allocator>& cc = c; - TEST_LIBCPP_ASSERT_FAILURE(cc.front(), "vector<bool>::front() called on an empty vector"); - TEST_LIBCPP_ASSERT_FAILURE(cc.back(), "vector<bool>::back() called on an empty vector"); - TEST_LIBCPP_ASSERT_FAILURE(cc[0], "vector<bool>::operator[] index out of bounds"); - } - - c.push_back(true); - c.push_back(false); - c.push_back(true); - TEST_LIBCPP_ASSERT_FAILURE(c[3], "vector<bool>::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(c[100], "vector<bool>::operator[] index out of bounds"); - - // Repeat the test with a const reference to test the const overloads. - { - const std::vector<bool, Allocator>& cc = c; - TEST_LIBCPP_ASSERT_FAILURE(cc[3], "vector<bool>::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(cc[100], "vector<bool>::operator[] index out of bounds"); - } - - TEST_LIBCPP_ASSERT_FAILURE( - c.erase(c.end()), "vector<bool>::erase(iterator) called with a non-dereferenceable iterator"); - TEST_LIBCPP_ASSERT_FAILURE( - c.erase(c.begin() + 1, c.begin()), "vector<bool>::erase(iterator, iterator) called with an invalid range"); -} - -int main(int, char**) { - test<std::allocator<bool>>(); - test<min_allocator<bool>>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp deleted file mode 100644 index 4d37b83b..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// typedef ... iterator; -// typedef ... const_iterator; - -// The libc++ __bit_iterator type has weird ABI calling conventions as a quirk -// of the implementation. The const bit iterator is trivial, but the non-const -// bit iterator is not because it declares a user-defined copy constructor. -// -// Changing this now is an ABI break, so this test ensures that each type -// is trivial/non-trivial as expected. - -// The definition of 'non-trivial for the purposes of calls': -// A type is considered non-trivial for the purposes of calls if: -// * it has a non-trivial copy constructor, move constructor, or -// destructor, or -// * all of its copy and move constructors are deleted. - -// UNSUPPORTED: c++03 - -#include <cassert> -#include <type_traits> -#include <vector> - -template <class T> -using IsTrivialForCall = std::integral_constant< - bool, - std::is_trivially_copy_constructible<T>::value && std::is_trivially_move_constructible<T>::value && - std::is_trivially_destructible<T>::value - // Ignore the all-deleted case, it shouldn't occur here. - >; - -void test_const_iterator() { - using It = std::vector<bool>::const_iterator; - static_assert(IsTrivialForCall<It>::value, ""); -} - -void test_non_const_iterator() { - using It = std::vector<bool>::iterator; - static_assert(!IsTrivialForCall<It>::value, ""); -} - -int main(int, char**) { - test_const_iterator(); - test_non_const_iterator(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/asan_turning_off.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/asan_turning_off.pass.cpp deleted file mode 100644 index 1ad60d0..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/asan_turning_off.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <vector> - -// Test based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1419798#c5 -// Some allocators during deallocation may not call destructors and just reuse memory. -// In those situations, one may want to deactivate annotations for a specific allocator. -// It's possible with __asan_annotate_container_with_allocator template class. -// This test confirms that those allocators work after turning off annotations. - -#include <assert.h> -#include <stdlib.h> -#include <vector> -#include <new> - -struct reuse_allocator { - static size_t const N = 100; - reuse_allocator() { - for (size_t i = 0; i < N; ++i) - __buffers[i] = malloc(8 * 1024); - } - ~reuse_allocator() { - for (size_t i = 0; i < N; ++i) - free(__buffers[i]); - } - void* alloc() { - assert(__next_id < N); - return __buffers[__next_id++]; - } - void reset() { __next_id = 0; } - void* __buffers[N]; - size_t __next_id = 0; -} reuse_buffers; - -template <typename T> -struct user_allocator { - using value_type = T; - user_allocator() = default; - template <class U> - user_allocator(user_allocator<U>) {} - friend bool operator==(user_allocator, user_allocator) { return true; } - friend bool operator!=(user_allocator x, user_allocator y) { return !(x == y); } - - T* allocate(size_t) { return (T*)reuse_buffers.alloc(); } - void deallocate(T*, size_t) noexcept {} -}; - -#ifdef _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS -template <class T> -struct std::__asan_annotate_container_with_allocator<user_allocator<T>> : false_type {}; -#endif - -int main(int, char**) { - using V = std::vector<int, user_allocator<int>>; - - { - V* v = new (reuse_buffers.alloc()) V(); - for (int i = 0; i < 100; i++) - v->push_back(i); - } - reuse_buffers.reset(); - { - V v; - for (int i = 0; i < 1000; i++) - v.push_back(i); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.back.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.back.empty.pass.cpp deleted file mode 100644 index 169ad1d..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.back.empty.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call back() on empty container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - assert(c.back() == 0); - c.clear(); - TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector"); - } - { - typedef int T; - typedef std::vector<T> C; - C c(1); - assert(c.back() == 0); - c.clear(); - TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.cback.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.cback.empty.pass.cpp deleted file mode 100644 index 5ceb4a1..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.cback.empty.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call back() on empty const container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - const C c; - TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector"); - } - - { - typedef int T; - typedef std::vector<T> C; - const C c; - TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.cfront.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.cfront.empty.pass.cpp deleted file mode 100644 index 20f94f1..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.cfront.empty.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call front() on empty const container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - const C c; - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector"); - } - - { - typedef int T; - typedef std::vector<T> C; - const C c; - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.cindex.oob.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.cindex.oob.pass.cpp deleted file mode 100644 index 3a9a7ad..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.cindex.oob.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Index const vector out of bounds. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - const C c(1); - assert(c[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds"); - } - - { - typedef int T; - typedef std::vector<T> C; - const C c(1); - assert(c[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.front.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.front.empty.pass.cpp deleted file mode 100644 index 85364c7..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.front.empty.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call front() on empty container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - assert(c.front() == 0); - c.clear(); - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector"); - } - - { - typedef int T; - typedef std::vector<T> C; - C c(1); - assert(c.front() == 0); - c.clear(); - TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.index.oob.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.index.oob.pass.cpp deleted file mode 100644 index 14cb896..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.index.oob.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Index vector out of bounds. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - assert(c[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds"); - } - - { - typedef int T; - typedef std::vector<T> C; - C c(1); - assert(c[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.add.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.add.pass.cpp deleted file mode 100644 index a066ad3..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.add.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Add to iterator out of bounds. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-vector -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "fill_to_capacity.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.begin(); - i += c.size(); - assert(i == c.end()); - i = c.begin(); - TEST_LIBCPP_ASSERT_FAILURE(i + 2, "__bounded_iter::operator+=: Attempt to advance an iterator past the end"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.begin(); - i += c.size(); - assert(i == c.end()); - i = c.begin(); - TEST_LIBCPP_ASSERT_FAILURE(i + 2, "__bounded_iter::operator+=: Attempt to advance an iterator past the end"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.decrement.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.decrement.pass.cpp deleted file mode 100644 index 59b9c16..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.decrement.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Decrement iterator prior to begin. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-vector -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c(1); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - TEST_LIBCPP_ASSERT_FAILURE(--i, "__bounded_iter::operator--: Attempt to rewind an iterator past the start"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - TEST_LIBCPP_ASSERT_FAILURE(--i, "__bounded_iter::operator--: Attempt to rewind an iterator past the start"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.dereference.pass.cpp deleted file mode 100644 index 877d365..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.dereference.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-vector -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <vector> - -#include "check_assertion.h" -#include "fill_to_capacity.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.increment.pass.cpp deleted file mode 100644 index e540f40..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.increment.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Increment iterator past end. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-vector -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "fill_to_capacity.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.begin(); - i += c.size(); - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "__bounded_iter::operator++: Attempt to advance an iterator past the end"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.begin(); - i += c.size(); - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "__bounded_iter::operator++: Attempt to advance an iterator past the end"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.index.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.index.pass.cpp deleted file mode 100644 index 63354af..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.iterator.index.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Index iterator out of bounds. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-vector -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <vector> -#include <cassert> - -#include "check_assertion.h" -#include "fill_to_capacity.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.begin(); - assert(i[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE( - i[c.size()], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - TEST_LIBCPP_ASSERT_FAILURE( - i[c.size() + 1], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c(1); - fill_to_capacity(c); - C::iterator i = c.begin(); - assert(i[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE( - i[c.size()], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - TEST_LIBCPP_ASSERT_FAILURE( - i[c.size() + 1], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/assert.pop_back.empty.pass.cpp deleted file mode 100644 index 6734f25..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/assert.pop_back.empty.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// pop_back() more than the number of elements in a vector - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - std::vector<int> v; - v.push_back(0); - v.pop_back(); - TEST_LIBCPP_ASSERT_FAILURE(v.pop_back(), "vector::pop_back called on an empty vector"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/debug.iterator.compare.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/debug.iterator.compare.pass.cpp deleted file mode 100644 index f3b8fb3..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/debug.iterator.compare.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Compare iterators from different containers with <. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <vector> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c1; - C c2; - TEST_LIBCPP_ASSERT_FAILURE(c1.begin() < c2.begin(), "Attempted to compare incomparable iterators"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c1; - C c2; - TEST_LIBCPP_ASSERT_FAILURE(c1.begin() < c2.begin(), "Attempted to compare incomparable iterators"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/debug.iterator.subtract.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/debug.iterator.subtract.pass.cpp deleted file mode 100644 index e3668d96..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/debug.iterator.subtract.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Subtract iterators from different containers. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <vector> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::vector<T> C; - C c1; - C c2; - TEST_LIBCPP_ASSERT_FAILURE(c1.begin() - c2.begin(), "Attempted to subtract incompatible iterators"); - } - - { - typedef int T; - typedef std::vector<T, min_allocator<T> > C; - C c1; - C c2; - TEST_LIBCPP_ASSERT_FAILURE(c1.begin() - c2.begin(), "Attempted to subtract incompatible iterators"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp deleted file mode 100644 index 66fdf37..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions - -// UNSUPPORTED: c++03 - -// <vector> - -// Test that vector always moves elements when exceptions are disabled. -// vector is allowed to move or copy elements while resizing, so long as -// it still provides the strong exception safety guarantee. - -#include <vector> -#include <cassert> - -#include "test_macros.h" - -#ifndef TEST_HAS_NO_EXCEPTIONS -# error exceptions should be disabled. -#endif - -bool allow_moves = false; - -class A { -public: - A() {} - A(A&&) { assert(allow_moves); } - explicit A(int) {} - A(A const&) { assert(false); } -}; - -int main(int, char**) { - std::vector<A> v; - - // Create a vector containing some number of elements that will - // have to be moved when it is resized. - v.reserve(10); - std::size_t old_cap = v.capacity(); - for (std::size_t i = 0; i < v.capacity(); ++i) { - v.emplace_back(42); - } - assert(v.capacity() == old_cap); - assert(v.size() == v.capacity()); - - // The next emplace back should resize. - allow_moves = true; - v.emplace_back(42); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h b/libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h deleted file mode 100644 index abf88c4..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef LIBCXX_TEST_LIBCXX_CONTAINERS_SEQUENCES_VECTOR_FILL_TO_CAPACITY_H -#define LIBCXX_TEST_LIBCXX_CONTAINERS_SEQUENCES_VECTOR_FILL_TO_CAPACITY_H - -#include <vector> - -template <typename T, typename A> -void fill_to_capacity(std::vector<T, A>& vec) { - // Fill the given vector up to its capacity. Our bounded iterators are currently unable to catch an out-of-bounds - // access that goes beyond the container's logical storage (above the size) but is still within its physical storage - // (below the capacity) due to iterator stability guarantees. Filling a vector makes this distinction go away. - while (vec.size() < vec.capacity()) { - vec.push_back(T()); - } -} - -#endif // LIBCXX_TEST_LIBCXX_CONTAINERS_SEQUENCES_VECTOR_FILL_TO_CAPACITY_H diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/robust_against_adl.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/robust_against_adl.pass.cpp deleted file mode 100644 index c6868ce..0000000 --- a/libcxx/test/libcxx-03/containers/sequences/vector/robust_against_adl.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <vector> - -#include <cstddef> -#include <memory> -#include <vector> - -#include "test_macros.h" - -struct Incomplete; -template <class T> -struct Holder { - T t; -}; - -template <class T, class AdlTrap = Holder<Incomplete>> -struct MyAlloc { - using value_type = T; - MyAlloc() = default; - template <class U> - MyAlloc(const MyAlloc<U>&) {} - T* allocate(std::size_t n) { return std::allocator<T>().allocate(n); } - void deallocate(T* p, std::size_t n) { return std::allocator<T>().deallocate(p, n); } -}; - -int main(int, char**) { - std::vector<bool, MyAlloc<bool>> vb; - // std::fill_n triggers ADL because __bit_iterator has the container type as a template argument - // std::vector<bool, MyAlloc<bool>> wb(100); - - std::vector<int, MyAlloc<int>> v; - std::vector<int, MyAlloc<int>> w(100); - v.push_back(1); - v.insert(v.end(), 2); - v.insert(v.end(), w.begin(), w.end()); - v.pop_back(); - v.erase(v.begin()); - v.erase(v.begin(), v.end()); -#if TEST_STD_VER >= 14 - // TODO: vector::swap is not robust against ADL because we compare allocators, and that - // triggers ADL when looking up operator==. - // v.swap(w); -#endif - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/strings/basic.string/asan.pass.cpp b/libcxx/test/libcxx-03/containers/strings/basic.string/asan.pass.cpp deleted file mode 100644 index c7e0924..0000000 --- a/libcxx/test/libcxx-03/containers/strings/basic.string/asan.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: asan -// UNSUPPORTED: c++03 - -// Basic test if ASan annotations work for basic_string. - -#include <string> -#include <cassert> -#include <cstdlib> - -#include "asan_testing.h" -#include "min_allocator.h" -#include "test_iterators.h" -#include "test_macros.h" - -extern "C" void __sanitizer_set_death_callback(void (*callback)(void)); - -void do_exit() { exit(0); } - -int main(int, char**) { - { - typedef cpp17_input_iterator<char*> MyInputIter; - // Should not trigger ASan. - std::basic_string<char, std::char_traits<char>, safe_allocator<char>> v; - char i[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'a', 'b', 'c', 'd', 'e', - 'f', 'g', 'h', 'i', 'j', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}; - - v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 29)); - assert(v[0] == 'a'); - assert(is_string_asan_correct(v)); - } - - __sanitizer_set_death_callback(do_exit); - { - using T = char; - using C = std::basic_string<T, std::char_traits<T>, safe_allocator<T>>; - const T t[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'a', 'b', 'c', 'd', 'e', - 'f', 'g', 'h', 'i', 'j', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}; - C c(std::begin(t), std::end(t)); - assert(is_string_asan_correct(c)); - assert(__sanitizer_verify_contiguous_container(c.data(), c.data() + c.size() + 1, c.data() + c.capacity() + 1) != - 0); - T foo = c[c.size() + 1]; // should trigger ASAN and call do_exit(). - assert(false); // if we got here, ASAN didn't trigger - ((void)foo); - - return 0; - } -} diff --git a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_deque_integration.pass.cpp b/libcxx/test/libcxx-03/containers/strings/basic.string/asan_deque_integration.pass.cpp deleted file mode 100644 index 1205190..0000000 --- a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_deque_integration.pass.cpp +++ /dev/null @@ -1,182 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: asan -// UNSUPPORTED: c++03 - -#include <cassert> -#include <string> -#include <array> -#include <deque> -#include "test_macros.h" -#include "asan_testing.h" -#include "min_allocator.h" - -// This tests exists to check if strings work well with deque, as those -// may be partialy annotated, we cannot simply call -// is_double_ended_contiguous_container_asan_correct, as it assumes that -// object memory inside is not annotated, so we check everything in a more careful way. - -template <typename D> -void verify_inside(D const& d) { - for (size_t i = 0; i < d.size(); ++i) { - assert(is_string_asan_correct(d[i])); - } -} - -template <typename S, size_t N> -S get_s(char c) { - S s; - for (size_t i = 0; i < N; ++i) - s.push_back(c); - - return s; -} - -template <class C, class S> -void test_string() { - size_t const N = sizeof(S) < 256 ? (4096 / sizeof(S)) : 16; - - { - C d1a(1), d1b(N), d1c(N + 1), d1d(5 * N); - verify_inside(d1a); - verify_inside(d1b); - verify_inside(d1c); - verify_inside(d1d); - } - { - C d2; - for (size_t i = 0; i < 3 * N + 2; ++i) { - d2.push_back(get_s<S, 1>(i % 10 + 'a')); - verify_inside(d2); - d2.push_back(get_s<S, 22>(i % 10 + 'b')); - verify_inside(d2); - - d2.pop_front(); - verify_inside(d2); - } - } - { - C d3; - for (size_t i = 0; i < 3 * N + 2; ++i) { - d3.push_front(get_s<S, 1>(i % 10 + 'a')); - verify_inside(d3); - d3.push_front(get_s<S, 28>(i % 10 + 'b')); - verify_inside(d3); - - d3.pop_back(); - verify_inside(d3); - } - } - { - C d4; - for (size_t i = 0; i < 3 * N + 2; ++i) { - // When there is no SSO, all elements inside should not be poisoned, - // so we can verify deque poisoning. - d4.push_front(get_s<S, 33>(i % 10 + 'a')); - verify_inside(d4); - assert(is_double_ended_contiguous_container_asan_correct(d4)); - d4.push_back(get_s<S, 28>(i % 10 + 'b')); - verify_inside(d4); - assert(is_double_ended_contiguous_container_asan_correct(d4)); - } - } - { - C d5; - for (size_t i = 0; i < 3 * N + 2; ++i) { - // In d4 we never had poisoned memory inside deque. - // Here we start with SSO, so part of the inside of the container, - // will be poisoned. - d5.push_front(S()); - verify_inside(d5); - } - for (size_t i = 0; i < d5.size(); ++i) { - // We change the size to have long string. - // Memory owne by deque should not be poisoned by string. - d5[i].resize(100); - verify_inside(d5); - } - - assert(is_double_ended_contiguous_container_asan_correct(d5)); - - d5.erase(d5.begin() + 2); - verify_inside(d5); - - d5.erase(d5.end() - 2); - verify_inside(d5); - - assert(is_double_ended_contiguous_container_asan_correct(d5)); - } - { - C d6a; - assert(is_double_ended_contiguous_container_asan_correct(d6a)); - - C d6b(N + 2, get_s<S, 100>('a')); - d6b.push_front(get_s<S, 101>('b')); - while (!d6b.empty()) { - d6b.pop_back(); - assert(is_double_ended_contiguous_container_asan_correct(d6b)); - } - - C d6c(N + 2, get_s<S, 102>('c')); - while (!d6c.empty()) { - d6c.pop_back(); - assert(is_double_ended_contiguous_container_asan_correct(d6c)); - } - } - { - C d7(9 * N + 2); - - d7.insert(d7.begin() + 1, S()); - verify_inside(d7); - - d7.insert(d7.end() - 3, S()); - verify_inside(d7); - - d7.insert(d7.begin() + 2 * N, get_s<S, 1>('a')); - verify_inside(d7); - - d7.insert(d7.end() - 2 * N, get_s<S, 1>('b')); - verify_inside(d7); - - d7.insert(d7.begin() + 2 * N, 3 * N, get_s<S, 1>('c')); - verify_inside(d7); - - // It may not be short for big element types, but it will be checked correctly: - d7.insert(d7.end() - 2 * N, 3 * N, get_s<S, 2>('d')); - verify_inside(d7); - - d7.erase(d7.begin() + 2); - verify_inside(d7); - - d7.erase(d7.end() - 2); - verify_inside(d7); - } -} - -template <class S> -void test_container() { - test_string<std::deque<S, std::allocator<S>>, S>(); - test_string<std::deque<S, min_allocator<S>>, S>(); - test_string<std::deque<S, safe_allocator<S>>, S>(); -} - -int main(int, char**) { - // Those tests support only types based on std::basic_string. - test_container<std::string>(); - test_container<std::wstring>(); -#if TEST_STD_VER >= 11 - test_container<std::u16string>(); - test_container<std::u32string>(); -#endif -#if TEST_STD_VER >= 20 - test_container<std::u8string>(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_short.pass.cpp b/libcxx/test/libcxx-03/containers/strings/basic.string/asan_short.pass.cpp deleted file mode 100644 index 53c70be..0000000 --- a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_short.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: asan -// UNSUPPORTED: c++03 - -// <string> - -// Basic test if ASan annotations work for short strings. - -#include <string> -#include <cassert> -#include <cstdlib> - -#include "asan_testing.h" -#include "min_allocator.h" -#include "test_iterators.h" -#include "test_macros.h" - -extern "C" void __sanitizer_set_death_callback(void (*callback)(void)); - -void do_exit() { exit(0); } - -int main(int, char**) { - { - typedef cpp17_input_iterator<char*> MyInputIter; - // Should not trigger ASan. - std::basic_string<char, std::char_traits<char>, safe_allocator<char>> v; - char i[] = {'a', 'b', 'c', 'd'}; - - v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 4)); - assert(v[0] == 'a'); - assert(is_string_asan_correct(v)); - } - - __sanitizer_set_death_callback(do_exit); - { - using T = char; - using C = std::basic_string<T, std::char_traits<T>, safe_allocator<T>>; - const T t[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g'}; - C c(std::begin(t), std::end(t)); - assert(is_string_asan_correct(c)); - assert(__sanitizer_verify_contiguous_container(c.data(), c.data() + c.size() + 1, c.data() + c.capacity() + 1) != - 0); - volatile T foo = c[c.size() + 1]; // should trigger ASAN. Use volatile to prevent being optimized away. - assert(false); // if we got here, ASAN didn't trigger - ((void)foo); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_turning_off.pass.cpp b/libcxx/test/libcxx-03/containers/strings/basic.string/asan_turning_off.pass.cpp deleted file mode 100644 index c8ee17c..0000000 --- a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_turning_off.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: asan -// UNSUPPORTED: c++03 - -// Test based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1419798#c5 -// Some allocators during deallocation may not call destructors and just reuse memory. -// In those situations, one may want to deactivate annotations for a specific allocator. -// It's possible with __asan_annotate_container_with_allocator template class. -// This test confirms that those allocators work after turning off annotations. -// -// A context to this test is a situations when memory is repurposed and destructors are not called. -// Related issue: https://github.com/llvm/llvm-project/issues/60384 -// -// That issue appeared in the past and was addressed here: https://reviews.llvm.org/D145628 -// -// There was also a discussion, if it's UB. -// Related discussion: https://reviews.llvm.org/D136765#4155262 -// Related notes: https://eel.is/c++draft/basic.life#6 -// Probably it's no longer UB due a change in CWG2523. -// https://cplusplus.github.io/CWG/issues/2523.html -// -// Therefore we make sure that it works that way, also because people rely on this behavior. -// Annotations are turned off only, if a user explicitly turns off annotations for a specific allocator. - -#include <assert.h> -#include <stdlib.h> -#include <string> -#include <new> - -// Allocator with pre-allocated (with malloc in constructor) buffers. -// Memory may be freed without calling destructors. -struct reuse_allocator { - static size_t const N = 100; - reuse_allocator() { - for (size_t i = 0; i < N; ++i) - __buffers[i] = malloc(8 * 1024); - } - ~reuse_allocator() { - for (size_t i = 0; i < N; ++i) - free(__buffers[i]); - } - void* alloc() { - assert(__next_id < N); - return __buffers[__next_id++]; - } - void reset() { __next_id = 0; } - void* __buffers[N]; - size_t __next_id = 0; -} reuse_buffers; - -template <typename T> -struct user_allocator { - using value_type = T; - user_allocator() = default; - template <class U> - user_allocator(user_allocator<U>) {} - friend bool operator==(user_allocator, user_allocator) { return true; } - friend bool operator!=(user_allocator x, user_allocator y) { return !(x == y); } - - T* allocate(size_t n) { - if (n * sizeof(T) > 8 * 1024) - throw std::bad_array_new_length(); - return (T*)reuse_buffers.alloc(); - } - void deallocate(T*, size_t) noexcept {} -}; - -// Turn off annotations for user_allocator: -template <class T> -struct std::__asan_annotate_container_with_allocator<user_allocator<T>> { - static bool const value = false; -}; - -int main(int, char**) { - using S = std::basic_string<char, std::char_traits<char>, user_allocator<char>>; - - { - // Create a string with a buffer from reuse allocator object: - S* s = new (reuse_buffers.alloc()) S(); - // Use string, so it's poisoned, if container annotations for that allocator are not turned off: - for (int i = 0; i < 40; i++) - s->push_back('a'); - } - // Reset the state of the allocator, don't call destructors, allow memory to be reused: - reuse_buffers.reset(); - { - // Create a next string with the same allocator, so the same buffer due to the reset: - S s; - // Use memory inside the string again, if it's poisoned, an error will be raised: - for (int i = 0; i < 60; i++) - s.push_back('a'); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_vector_integration.pass.cpp b/libcxx/test/libcxx-03/containers/strings/basic.string/asan_vector_integration.pass.cpp deleted file mode 100644 index b7d95b7..0000000 --- a/libcxx/test/libcxx-03/containers/strings/basic.string/asan_vector_integration.pass.cpp +++ /dev/null @@ -1,182 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: asan -// UNSUPPORTED: c++03 - -#include <cassert> -#include <string> -#include <vector> -#include <array> -#include "test_macros.h" -#include "asan_testing.h" -#include "min_allocator.h" - -// This tests exists to check if strings work well with vector, as those -// may be partialy annotated, we cannot simply call -// is_contiguous_container_asan_correct, as it assumes that -// object memory inside is not annotated, so we check everything in a more careful way. - -template <typename D> -void verify_inside(D const& d) { - for (size_t i = 0; i < d.size(); ++i) { - assert(is_string_asan_correct(d[i])); - } -} - -template <typename S, size_t N> -S get_s(char c) { - S s; - for (size_t i = 0; i < N; ++i) - s.push_back(c); - - return s; -} - -template <class C, class S> -void test_string() { - size_t const N = sizeof(S) < 256 ? (4096 / sizeof(S)) : 16; - - { - C d1a(1), d1b(N), d1c(N + 1), d1d(5 * N); - verify_inside(d1a); - verify_inside(d1b); - verify_inside(d1c); - verify_inside(d1d); - } - { - C d2; - for (size_t i = 0; i < 3 * N + 2; ++i) { - d2.push_back(get_s<S, 1>(i % 10 + 'a')); - verify_inside(d2); - d2.push_back(get_s<S, 28>(i % 10 + 'b')); - verify_inside(d2); - - d2.erase(d2.cbegin()); - verify_inside(d2); - } - } - { - C d3; - for (size_t i = 0; i < 3 * N + 2; ++i) { - d3.push_back(get_s<S, 1>(i % 10 + 'a')); - verify_inside(d3); - d3.push_back(get_s<S, 28>(i % 10 + 'b')); - verify_inside(d3); - - d3.pop_back(); - verify_inside(d3); - } - } - { - C d4; - for (size_t i = 0; i < 3 * N + 2; ++i) { - // When there is no SSO, all elements inside should not be poisoned, - // so we can verify vector poisoning. - d4.push_back(get_s<S, 33>(i % 10 + 'a')); - verify_inside(d4); - assert(is_contiguous_container_asan_correct(d4)); - d4.push_back(get_s<S, 28>(i % 10 + 'b')); - verify_inside(d4); - assert(is_contiguous_container_asan_correct(d4)); - } - } - { - C d5; - for (size_t i = 0; i < 3 * N + 2; ++i) { - // In d4 we never had poisoned memory inside vector. - // Here we start with SSO, so part of the inside of the container, - // will be poisoned. - d5.push_back(S()); - verify_inside(d5); - } - for (size_t i = 0; i < d5.size(); ++i) { - // We change the size to have long string. - // Memory owne by vector should not be poisoned by string. - d5[i].resize(100); - verify_inside(d5); - } - - assert(is_contiguous_container_asan_correct(d5)); - - d5.erase(d5.begin() + 2); - verify_inside(d5); - - d5.erase(d5.end() - 2); - verify_inside(d5); - - assert(is_contiguous_container_asan_correct(d5)); - } - { - C d6a; - assert(is_contiguous_container_asan_correct(d6a)); - - C d6b(N + 2, get_s<S, 100>('a')); - d6b.push_back(get_s<S, 101>('b')); - while (!d6b.empty()) { - d6b.pop_back(); - assert(is_contiguous_container_asan_correct(d6b)); - } - - C d6c(N + 2, get_s<S, 102>('c')); - while (!d6c.empty()) { - d6c.pop_back(); - assert(is_contiguous_container_asan_correct(d6c)); - } - } - { - C d7(9 * N + 2); - - d7.insert(d7.begin() + 1, S()); - verify_inside(d7); - - d7.insert(d7.end() - 3, S()); - verify_inside(d7); - - d7.insert(d7.begin() + 2 * N, get_s<S, 1>('a')); - verify_inside(d7); - - d7.insert(d7.end() - 2 * N, get_s<S, 1>('b')); - verify_inside(d7); - - d7.insert(d7.begin() + 2 * N, 3 * N, get_s<S, 1>('c')); - verify_inside(d7); - - // It may not be short for big element types, but it will be checked correctly: - d7.insert(d7.end() - 2 * N, 3 * N, get_s<S, 2>('d')); - verify_inside(d7); - - d7.erase(d7.begin() + 2); - verify_inside(d7); - - d7.erase(d7.end() - 2); - verify_inside(d7); - } -} - -template <class S> -void test_container() { - test_string<std::vector<S, std::allocator<S>>, S>(); - test_string<std::vector<S, min_allocator<S>>, S>(); - test_string<std::vector<S, safe_allocator<S>>, S>(); -} - -int main(int, char**) { - // Those tests support only types based on std::basic_string. - test_container<std::string>(); - test_container<std::wstring>(); -#if TEST_STD_VER >= 11 - test_container<std::u16string>(); - test_container<std::u32string>(); -#endif -#if TEST_STD_VER >= 20 - test_container<std::u8string>(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/next_pow2.pass.cpp b/libcxx/test/libcxx-03/containers/unord/next_pow2.pass.cpp deleted file mode 100644 index 53a1dd2..0000000 --- a/libcxx/test/libcxx-03/containers/unord/next_pow2.pass.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// REQUIRES: long_tests -// UNSUPPORTED: c++03 - -// Not a portable test - -// <__hash_table> - -// size_t __next_hash_pow2(size_t n); - -// If n <= 1, return n. If n is a power of 2, return n. -// Otherwise, return the next power of 2. - -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - -#include <__hash_table> -#include <cassert> -#include <cstdint> -#include <unordered_map> - -#include "test_macros.h" - -bool is_power_of_two(unsigned long n) { return __builtin_popcount(n) == 1; } - -void test_next_pow2_val(std::size_t n) { - std::size_t npow2 = std::__next_hash_pow2(n); - assert(is_power_of_two(npow2) && npow2 > n); -} - -void test_next_pow2() { - assert(!is_power_of_two(0)); - assert(is_power_of_two(1)); - assert(is_power_of_two(2)); - assert(!is_power_of_two(3)); - - assert(std::__next_hash_pow2(0) == 0); - assert(std::__next_hash_pow2(1) == 1); - - for (std::size_t n = 2; n < (sizeof(std::size_t) * 8 - 1); ++n) { - std::size_t pow2 = 1ULL << n; - assert(std::__next_hash_pow2(pow2) == pow2); - } - - test_next_pow2_val(3); - test_next_pow2_val(7); - test_next_pow2_val(9); - test_next_pow2_val(15); - test_next_pow2_val(127); - test_next_pow2_val(129); -} - -// Note: this is only really useful when run with -fsanitize=undefined. -void fuzz_unordered_map_reserve(unsigned num_inserts, unsigned num_reserve1, unsigned num_reserve2) { - std::unordered_map<std::uint64_t, unsigned long> m; - m.reserve(num_reserve1); - for (unsigned I = 0; I < num_inserts; ++I) - m[I] = 0; - m.reserve(num_reserve2); - assert(m.bucket_count() >= num_reserve2); -} - -int main(int, char**) { - test_next_pow2(); - - for (unsigned num_inserts = 0; num_inserts <= 64; ++num_inserts) - for (unsigned num_reserve1 = 1; num_reserve1 <= 64; ++num_reserve1) - for (unsigned num_reserve2 = 1; num_reserve2 <= 64; ++num_reserve2) - fuzz_unordered_map_reserve(num_inserts, num_reserve1, num_reserve2); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/non_const_comparator.incomplete.verify.cpp b/libcxx/test/libcxx-03/containers/unord/non_const_comparator.incomplete.verify.cpp deleted file mode 100644 index c370cd6..0000000 --- a/libcxx/test/libcxx-03/containers/unord/non_const_comparator.incomplete.verify.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Test that libc++ does not generate a warning diagnostic about the comparator -// or the hasher too early for containers of incomplete types. -// -// See PR41360. - -#include <unordered_set> -#include <unordered_map> -#include <functional> - -#include "test_macros.h" - -template <template <typename...> class Container> -void test_set() { - struct KeyBase {}; - struct KeyDerived; // derives from KeyBase, but incomplete at this point - - // Name the type but don't instantiate it. - using C = Container<KeyDerived*, std::hash<KeyBase*>, std::equal_to<KeyBase*>>; - - // Instantiate it but don't ODR use any members. - typename C::value_type dummy; - (void)dummy; - - // Complete the types. - struct KeyDerived : KeyBase {}; - - C c; // ODR use it, which should be OK -} - -template <template <typename...> class Container> -void test_map() { - struct Value {}; - struct KeyBase {}; - struct KeyDerived; - using C = Container<KeyDerived*, Value, std::hash<KeyBase*>, std::equal_to<KeyBase*>>; - typename C::value_type dummy; - (void)dummy; - struct KeyDerived : KeyBase {}; - C c; -} - -void f() { - // expected-no-diagnostics - test_set<std::unordered_set>(); - test_set<std::unordered_multiset>(); - test_map<std::unordered_map>(); - test_map<std::unordered_multimap>(); -} diff --git a/libcxx/test/libcxx-03/containers/unord/non_const_comparator.verify.cpp b/libcxx/test/libcxx-03/containers/unord/non_const_comparator.verify.cpp deleted file mode 100644 index c341830..0000000 --- a/libcxx/test/libcxx-03/containers/unord/non_const_comparator.verify.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// REQUIRES: diagnose-if-support - -// Test that libc++ generates a warning diagnostic when the container is -// provided a non-const callable comparator or a non-const hasher. - -#include <__type_traits/invoke.h> -#include <unordered_set> -#include <unordered_map> - -struct BadHash { - template <class T> - std::size_t operator()(T const& t) { - return std::hash<T>{}(t); - } -}; - -struct BadEqual { - template <class T, class U> - bool operator()(T const& t, U const& u) { - return t == u; - } -}; - -void f() { - static_assert(!std::__is_invocable_v<BadEqual const&, int const&, int const&>, ""); - static_assert(std::__is_invocable_v<BadEqual&, int const&, int const&>, ""); - - // expected-warning@unordered_set:* 2 {{the specified comparator type does not provide a viable const call operator}} - // expected-warning@unordered_map:* 2 {{the specified comparator type does not provide a viable const call operator}} - // expected-warning@unordered_set:* 2 {{the specified hash functor does not provide a viable const call operator}} - // expected-warning@unordered_map:* 2 {{the specified hash functor does not provide a viable const call operator}} - - { - using C = std::unordered_set<int, BadHash, BadEqual>; - C s; - } - { - using C = std::unordered_multiset<long, BadHash, BadEqual>; - C s; - } - { - using C = std::unordered_map<int, int, BadHash, BadEqual>; - C s; - } - { - using C = std::unordered_multimap<long, int, BadHash, BadEqual>; - C s; - } -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.bucket.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.bucket.pass.cpp deleted file mode 100644 index 26621bc..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.bucket.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// size_type bucket(const key_type& __k) const; - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_map<int, std::string> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.bucket_size.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.bucket_size.pass.cpp deleted file mode 100644 index ce6534f..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.bucket_size.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, T>>> -// class unordered_map - -// size_type bucket_size(size_type n) const - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_map<int, std::string> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.iterator.dereference.pass.cpp deleted file mode 100644 index f57341d..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.iterator.dereference.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_map<int, std::string> C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - { - typedef std::unordered_map<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.iterator.increment.pass.cpp deleted file mode 100644 index 3f4d1c2..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.iterator.increment.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Increment iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <cassert> -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_map<int, std::string> C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator"); - C::const_iterator i2 = c.cbegin(); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - { - typedef std::unordered_map<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator"); - C::const_iterator i2 = c.cbegin(); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp deleted file mode 100644 index 8b47f54..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_map<int, std::string> C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - { - typedef std::unordered_map<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp deleted file mode 100644 index 8f83058..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Increment local_iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_map<int, std::string> C; - C c; - c.insert(std::make_pair(42, std::string())); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - { - typedef std::unordered_map<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c({{42, std::string()}}); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/assert.max_load_factor.pass.cpp deleted file mode 100644 index 117758c..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/assert.max_load_factor.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, T>>> -// class unordered_map - -// float max_load_factor() const; -// void max_load_factor(float mlf); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_map<int, std::string> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/at.abort.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/at.abort.pass.cpp deleted file mode 100644 index bd6da6c..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/at.abort.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// class unordered_map - -// mapped_type& at(const key_type& k); - -// Make sure we abort() when exceptions are disabled and we fetch a key that -// is not in the map. - -// REQUIRES: no-exceptions -// UNSUPPORTED: c++03 - -#include <csignal> -#include <cstdlib> -#include <unordered_map> - -#include "test_macros.h" - -int main(int, char**) { - std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); }); - std::unordered_map<int, int> map; - map.at(1); - return EXIT_FAILURE; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/at.const.abort.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/at.const.abort.pass.cpp deleted file mode 100644 index badd243..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/at.const.abort.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// class unordered_map - -// const mapped_type& at(const key_type& k) const; - -// Make sure we abort() when exceptions are disabled and we fetch a key that -// is not in the map. - -// REQUIRES: no-exceptions -// UNSUPPORTED: c++03 - -#include <csignal> -#include <cstdlib> -#include <unordered_map> - -#include "test_macros.h" - -int main(int, char**) { - std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); }); - std::unordered_map<int, int> const map; - map.at(1); - return EXIT_FAILURE; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp deleted file mode 100644 index 927a9e8..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// iterator insert(const_iterator p, const value_type& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" -#include "test_macros.h" - -int main(int, char**) { - typedef std::unordered_map<double, int> C; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - P v(3.5, 3); -#if TEST_STD_VER < 11 - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, v), - "unordered_map::insert(const_iterator, const value_type&) called with an iterator not " - "referring to this unordered_map"); -#else - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, v), - "unordered_map::insert(const_iterator, value_type&&) called with an iterator not " - "referring to this unordered_map"); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp deleted file mode 100644 index e8a34c3..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class P, -// class = typename enable_if<is_convertible<P, value_type>::value>::type> -// iterator insert(const_iterator p, P&& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" -#include "test_macros.h" - -int main(int, char**) { - typedef std::unordered_map<double, int> C; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, P(3.5, 3)), - "unordered_map::insert(const_iterator, const value_type&) called with an iterator not " - "referring to this unordered_map"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/debug.swap.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/debug.swap.pass.cpp deleted file mode 100644 index cda7f97..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/debug.swap.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class Value, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, Value>>> -// class unordered_map - -// void swap(unordered_map& x, unordered_map& y); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(3, 3), P(7, 7), P(9, 9), P(10, 10)}; - P a2[] = {P(0, 0), P(2, 2), P(4, 4), P(5, 5), P(6, 6), P(8, 8), P(11, 11)}; - std::unordered_map<int, int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0])); - std::unordered_map<int, int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0])); - std::unordered_map<int, int>::iterator i1 = c1.begin(); - std::unordered_map<int, int>::iterator i2 = c2.begin(); - swap(c1, c2); - c1.erase(i2); - TEST_LIBCPP_ASSERT_FAILURE( - c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp deleted file mode 100644 index ef5a53e..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Call erase(const_iterator position) with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - // With end() - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_map<int, int> l1(a1, a1 + 3); - std::unordered_map<int, int>::const_iterator i = l1.end(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator"); - } - - // With iterator from another container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_map<int, int> l1(a1, a1 + 3); - std::unordered_map<int, int> l2(a1, a1 + 3); - std::unordered_map<int, int>::const_iterator i = l2.begin(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp deleted file mode 100644 index 1f364bf..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Call erase(const_iterator first, const_iterator last); with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - // First iterator from a different container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_map<int, int> l1(a1, a1 + 3); - std::unordered_map<int, int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l1.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // Second iterator from a different container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_map<int, int> l1(a1, a1 + 3); - std::unordered_map<int, int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l1.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // Both iterators from a different container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_map<int, int> l1(a1, a1 + 3); - std::unordered_map<int, int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With iterators that don't form a valid range - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_map<int, int> l1(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()), - "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.bucket.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.bucket.pass.cpp deleted file mode 100644 index 61c1651..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.bucket.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, T>>> -// class unordered_multimap - -// size_type bucket(const key_type& __k) const; - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multimap<int, std::string> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.bucket_size.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.bucket_size.pass.cpp deleted file mode 100644 index 8f2efdb6..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.bucket_size.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, T>>> -// class unordered_multimap - -// size_type bucket_size(size_type n) const - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multimap<int, std::string> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp deleted file mode 100644 index d295a82..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> -#include <unordered_map> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_multimap<int, std::string> C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - { - typedef std::unordered_multimap<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp deleted file mode 100644 index 4247edc..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Increment iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <cassert> -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_multimap<int, std::string> C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator"); - C::const_iterator i2 = c.cbegin(); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - { - typedef std::unordered_multimap<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c; - c.insert(std::make_pair(1, "one")); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator"); - C::const_iterator i2 = c.cbegin(); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp deleted file mode 100644 index 7ea8796..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_multimap<int, std::string> C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - { - typedef std::unordered_multimap<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp deleted file mode 100644 index ffa3fec..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Increment local_iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <cassert> -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef std::unordered_multimap<int, std::string> C; - C c; - c.insert(std::make_pair(42, std::string())); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - { - typedef std::unordered_multimap<int, - std::string, - std::hash<int>, - std::equal_to<int>, - min_allocator<std::pair<const int, std::string>>> - C; - C c({{1, std::string()}}); - c.insert(std::make_pair(42, std::string())); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp deleted file mode 100644 index dda5fe8..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, T>>> -// class unordered_multimap - -// float max_load_factor() const; -// void max_load_factor(float mlf); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_map> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multimap<int, std::string> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp deleted file mode 100644 index 0174310..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// iterator insert(const_iterator p, const value_type& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multimap<double, int> C; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - P v(3.5, 3); - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, v), - "unordered container::emplace_hint(const_iterator, args...) called with an iterator not " - "referring to this unordered container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp deleted file mode 100644 index 3713d78..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class P, -// class = typename enable_if<is_convertible<P, value_type>::value>::type> -// iterator insert(const_iterator p, P&& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multimap<double, int> C; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, P(3.5, 3)), - "unordered container::emplace_hint(const_iterator, args...) called with an iterator not " - "referring to this unordered container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.swap.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.swap.pass.cpp deleted file mode 100644 index d467182..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/debug.swap.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// template <class Key, class Value, class Hash = hash<Key>, class Pred = equal_to<Key>, -// class Alloc = allocator<pair<const Key, Value>>> -// class unordered_multimap - -// void swap(unordered_multimap& x, unordered_multimap& y); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(3, 3), P(7, 7), P(9, 9), P(10, 10)}; - P a2[] = {P(0, 0), P(2, 2), P(4, 4), P(5, 5), P(6, 6), P(8, 8), P(11, 11)}; - std::unordered_multimap<int, int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0])); - std::unordered_multimap<int, int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0])); - std::unordered_multimap<int, int>::iterator i1 = c1.begin(); - std::unordered_multimap<int, int>::iterator i2 = c2.begin(); - swap(c1, c2); - c1.erase(i2); - TEST_LIBCPP_ASSERT_FAILURE( - c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp deleted file mode 100644 index 0a430ed..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Call erase(const_iterator position) with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - // With end() - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_multimap<int, int> l1(a1, a1 + 3); - std::unordered_multimap<int, int>::const_iterator i = l1.end(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator"); - } - - // With iterator from another container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_multimap<int, int> l1(a1, a1 + 3); - std::unordered_multimap<int, int> l2(a1, a1 + 3); - std::unordered_multimap<int, int>::const_iterator i = l2.begin(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp deleted file mode 100644 index 8c1382c..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_map> - -// Call erase(const_iterator first, const_iterator last); with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_map> - -#include "check_assertion.h" - -int main(int, char**) { - // With first iterator from another container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_multimap<int, int> l1(a1, a1 + 3); - std::unordered_multimap<int, int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l1.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With second iterator from another container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_multimap<int, int> l1(a1, a1 + 3); - std::unordered_multimap<int, int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l1.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With both iterators from another container - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_multimap<int, int> l1(a1, a1 + 3); - std::unordered_multimap<int, int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With an invalid range - { - typedef std::pair<int, int> P; - P a1[] = {P(1, 1), P(2, 2), P(3, 3)}; - std::unordered_multimap<int, int> l1(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()), - "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.bucket.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.bucket.pass.cpp deleted file mode 100644 index eebf11c..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.bucket.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_multiset - -// size_type bucket(const key_type& __k) const; - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multiset<int> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.bucket_size.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.bucket_size.pass.cpp deleted file mode 100644 index 1c107ca..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.bucket_size.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_multiset - -// size_type bucket_size(size_type n) const - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multiset<int> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp deleted file mode 100644 index 31edd60..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_multiset<T> C; - C c(1); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - { - typedef int T; - typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c(1); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp deleted file mode 100644 index 0e0e4aa..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Increment iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_multiset<T> C; - C c; - c.insert(42); - C::iterator i = c.begin(); - assert(i != c.end()); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator"); - C::const_iterator i2 = c.cbegin(); - assert(i2 != c.cend()); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - { - typedef int T; - typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c({42}); - C::iterator i = c.begin(); - assert(i != c.end()); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator"); - C::const_iterator i2 = c.cbegin(); - assert(i2 != c.cend()); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp deleted file mode 100644 index fe833c4..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_multiset<T> C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - { - typedef int T; - typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp deleted file mode 100644 index 142c07f..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Increment local_iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_multiset<T> C; - C c; - c.insert(42); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - { - typedef int T; - typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c({42}); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp deleted file mode 100644 index a388494..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_multiset - -// float max_load_factor() const; -// void max_load_factor(float mlf); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multiset<int> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.erase.iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.erase.iter.pass.cpp deleted file mode 100644 index 41818b8..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.erase.iter.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Call erase(const_iterator position) with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - // With end() - { - int a1[] = {1, 2, 3}; - std::unordered_multiset<int> l1(a1, a1 + 3); - std::unordered_multiset<int>::const_iterator i = l1.end(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator"); - } - - // With iterator from another container - { - int a1[] = {1, 2, 3}; - std::unordered_multiset<int> l1(a1, a1 + 3); - std::unordered_multiset<int> l2(a1, a1 + 3); - std::unordered_multiset<int>::const_iterator i = l2.begin(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp deleted file mode 100644 index a85a61c..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Call erase(const_iterator first, const_iterator last); with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - // With first iterator from another container - { - int a1[] = {1, 2, 3}; - std::unordered_multiset<int> l1(a1, a1 + 3); - std::unordered_multiset<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l1.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With second iterator from another container - { - int a1[] = {1, 2, 3}; - std::unordered_multiset<int> l1(a1, a1 + 3); - std::unordered_multiset<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l1.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With both iterators from another container - { - int a1[] = {1, 2, 3}; - std::unordered_multiset<int> l1(a1, a1 + 3); - std::unordered_multiset<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With an invalid range - { - int a1[] = {1, 2, 3}; - std::unordered_multiset<int> l1(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()), - "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp deleted file mode 100644 index 2274dd3..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// iterator insert(const_iterator p, const value_type& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_multiset<double> C; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - P v(3.5); - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, v), - "unordered container::emplace_hint(const_iterator, args...) called with an iterator not " - "referring to this unordered container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.swap.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.swap.pass.cpp deleted file mode 100644 index aa6b56f..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.multiset/debug.swap.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_multiset - -// void swap(unordered_multiset& x, unordered_multiset& y); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - int a1[] = {1, 3, 7, 9, 10}; - int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::unordered_multiset<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0])); - std::unordered_multiset<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0])); - std::unordered_multiset<int>::iterator i1 = c1.begin(); - std::unordered_multiset<int>::iterator i2 = c2.begin(); - swap(c1, c2); - c1.erase(i2); - TEST_LIBCPP_ASSERT_FAILURE( - c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.bucket.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.bucket.pass.cpp deleted file mode 100644 index 6504a88..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.bucket.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_set - -// size_type bucket(const key_type& __k) const; - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_set<int> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.bucket_size.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.bucket_size.pass.cpp deleted file mode 100644 index 18440548..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.bucket_size.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_set - -// size_type bucket_size(size_type n) const - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_set<int> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.iterator.dereference.pass.cpp deleted file mode 100644 index 8464601..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.iterator.dereference.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_set<T> C; - C c(1); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - { - typedef int T; - typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c(1); - C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - C::const_iterator i2 = c.cend(); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.iterator.increment.pass.cpp deleted file mode 100644 index 2944688..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.iterator.increment.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Increment iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_set<T> C; - C c; - c.insert(42); - C::iterator i = c.begin(); - assert(i != c.end()); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator"); - C::const_iterator i2 = c.cbegin(); - assert(i2 != c.cend()); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - { - typedef int T; - typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c({42}); - C::iterator i = c.begin(); - assert(i != c.end()); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator"); - C::const_iterator i2 = c.cbegin(); - assert(i2 != c.cend()); - ++i2; - assert(i2 == c.cend()); - TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp deleted file mode 100644 index 7163e37..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_set<T> C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - { - typedef int T; - typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c(1); - C::local_iterator i = c.end(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cend(0); - TEST_LIBCPP_ASSERT_FAILURE( - *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp deleted file mode 100644 index c9fe5af..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Increment local_iterator past end. - -// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -int main(int, char**) { - { - typedef int T; - typedef std::unordered_set<T> C; - C c; - c.insert(42); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - { - typedef int T; - typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C; - C c({42}); - C::size_type b = c.bucket(42); - C::local_iterator i = c.begin(b); - assert(i != c.end(b)); - ++i; - assert(i == c.end(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - C::const_local_iterator i2 = c.cbegin(b); - assert(i2 != c.cend(b)); - ++i2; - assert(i2 == c.cend(b)); - TEST_LIBCPP_ASSERT_FAILURE( - ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/assert.max_load_factor.pass.cpp deleted file mode 100644 index 80e8941..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/assert.max_load_factor.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_set - -// float max_load_factor() const; -// void max_load_factor(float mlf); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_set<int> C; - C c; - TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(-0.5f), "unordered container::max_load_factor(lf) called with lf <= 0"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.erase.iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/debug.erase.iter.pass.cpp deleted file mode 100644 index 8dbcb05..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.erase.iter.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Call erase(const_iterator position) with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - // With end() - { - int a1[] = {1, 2, 3}; - std::unordered_set<int> l1(a1, a1 + 3); - std::unordered_set<int>::const_iterator i = l1.end(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator"); - } - - // With iterator from another container - { - int a1[] = {1, 2, 3}; - std::unordered_set<int> l1(a1, a1 + 3); - std::unordered_set<int> l2(a1, a1 + 3); - std::unordered_set<int>::const_iterator i = l2.begin(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp deleted file mode 100644 index c714b70..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// Call erase(const_iterator first, const_iterator last); with first iterator from another container - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - // With first iterator from another container - { - int a1[] = {1, 2, 3}; - std::unordered_set<int> l1(a1, a1 + 3); - std::unordered_set<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l1.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With second iterator from another container - { - int a1[] = {1, 2, 3}; - std::unordered_set<int> l1(a1, a1 + 3); - std::unordered_set<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l1.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With both iterators from another container - { - int a1[] = {1, 2, 3}; - std::unordered_set<int> l1(a1, a1 + 3); - std::unordered_set<int> l2(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), std::next(l2.cbegin())), - "unordered container::erase(iterator, iterator) called with an iterator not referring to this container"); - } - - // With an invalid range - { - int a1[] = {1, 2, 3}; - std::unordered_set<int> l1(a1, a1 + 3); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()), - "Attempted to increment a non-incrementable unordered container const_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp deleted file mode 100644 index 2d4e0e7..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// iterator insert(const_iterator p, const value_type& x); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - typedef std::unordered_set<double> C; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - P v(3.5); - TEST_LIBCPP_ASSERT_FAILURE( - c.insert(e, v), - "unordered_set::insert(const_iterator, const value_type&) called with an iterator not " - "referring to this unordered_set"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.swap.pass.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/debug.swap.pass.cpp deleted file mode 100644 index 8f362f3..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/debug.swap.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <unordered_set> - -// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, -// class Alloc = allocator<Value>> -// class unordered_set - -// void swap(unordered_set& x, unordered_set& y); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <unordered_set> - -#include "check_assertion.h" - -int main(int, char**) { - int a1[] = {1, 3, 7, 9, 10}; - int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::unordered_set<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0])); - std::unordered_set<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0])); - std::unordered_set<int>::iterator i1 = c1.begin(); - std::unordered_set<int>::iterator i2 = c2.begin(); - swap(c1, c2); - c1.erase(i2); - TEST_LIBCPP_ASSERT_FAILURE( - c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/unord/unord.set/missing_hash_specialization.verify.cpp b/libcxx/test/libcxx-03/containers/unord/unord.set/missing_hash_specialization.verify.cpp deleted file mode 100644 index c66496a..0000000 --- a/libcxx/test/libcxx-03/containers/unord/unord.set/missing_hash_specialization.verify.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: diagnose-if-support -// UNSUPPORTED: c++03 - -// Libc++ only provides a defined primary template for std::hash in C++14 and -// newer. -// UNSUPPORTED: c++11 - -// <unordered_set> - -// Test that we generate a reasonable diagnostic when the specified hash is -// not enabled. - -#include <unordered_set> -#include <utility> - -using VT = std::pair<int, int>; - -struct BadHashNoCopy { - BadHashNoCopy() = default; - BadHashNoCopy(BadHashNoCopy const&) = delete; - - template <class T> - std::size_t operator()(T const&) const { - return 0; - } -}; - -struct BadHashNoCall {}; - -struct GoodHashNoDefault { - explicit GoodHashNoDefault(void*) {} - template <class T> - std::size_t operator()(T const&) const { - return 0; - } -}; - -int main(int, char**) { - { - using Set = std::unordered_set<VT>; - Set s; // expected-error@__hash_table:* {{the specified hash does not meet the Hash requirements}} - - // FIXME: It would be great to suppress the below diagnostic all together. - // but for now it's sufficient that it appears last. However there is - // currently no way to test the order diagnostics are issued. - // expected-error@*:* {{call to implicitly-deleted default constructor}} - } - { - using Set = std::unordered_set<int, BadHashNoCopy>; - Set s; // expected-error@__hash_table:* {{the specified hash does not meet the Hash requirements}} - } - { - using Set = std::unordered_set<int, BadHashNoCall>; - Set s; // expected-error@__hash_table:* {{the specified hash does not meet the Hash requirements}} - } - { - using Set = std::unordered_set<int, GoodHashNoDefault>; - Set s(/*bucketcount*/ 42, GoodHashNoDefault(nullptr)); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/aligned_accessor/byte_alignment.verify.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/aligned_accessor/byte_alignment.verify.cpp deleted file mode 100644 index fbc8386..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/aligned_accessor/byte_alignment.verify.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 - -// <mdspan> - -// template<class ElementType, size_t ByteAlignment> -// class aligned_accessor; - -// ByteAlignement is required to be a power of two and greater or equal to alignof(ElementType). - -#include <mdspan> - -void not_power_of_two() { - // expected-error-re@*:* {{static assertion failed {{.*}}aligned_accessor: byte alignment must be a power of two}} - [[maybe_unused]] std::aligned_accessor<int, 12> acc; -} - -struct alignas(8) S {}; - -void insufficiently_aligned() { - // expected-error-re@*:* {{static assertion failed {{.*}}aligned_accessor: insufficient byte alignment}} - [[maybe_unused]] std::aligned_accessor<S, 4> acc; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/aligned_accessor/element_type.verify.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/aligned_accessor/element_type.verify.cpp deleted file mode 100644 index 91510a9..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/aligned_accessor/element_type.verify.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 - -// <mdspan> - -// template<class ElementType, size_t ByteAlignment> -// class aligned_accessor; - -// ElementType is required to be a complete object type that is neither an abstract class type nor an array type. - -#include <mdspan> - -class AbstractClass { -public: - virtual void method() = 0; -}; - -void not_abstract_class() { - // expected-error-re@*:* {{static assertion failed {{.*}}aligned_accessor: template argument may not be an abstract class}} - [[maybe_unused]] std::aligned_accessor<AbstractClass, 8> acc; -} - -void not_array_type() { - // expected-error-re@*:* {{static assertion failed {{.*}}aligned_accessor: template argument may not be an array type}} - [[maybe_unused]] std::aligned_accessor<int[5], 128> acc; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.conversion.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.conversion.pass.cpp deleted file mode 100644 index 31766e4..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.conversion.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherIndexType, size_t... OtherExtents> -// constexpr explicit(see below) extents(const extents<OtherIndexType, OtherExtents...>&) noexcept; -// -// Constraints: -// * sizeof...(OtherExtents) == rank() is true. -// * ((OtherExtents == dynamic_extent || Extents == dynamic_extent || -// OtherExtents == Extents) && ...) is true. -// -// Preconditions: -// * other.extent(r) equals Er for each r for which Er is a static extent, and -// * either -// - sizeof...(OtherExtents) is zero, or -// - other.extent(r) is representable as a value of type index_type for -// every rank index r of other. -// -// Remarks: The expression inside explicit is equivalent to: -// (((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || ... ) || -// (numeric_limits<index_type>::max() < numeric_limits<OtherIndexType>::max()) - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - std::extents<int, D, D> arg{1000, 5}; - - // working case - { - [[maybe_unused]] std::extents<size_t, D, 5> e(arg); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::extents<int, D, 3> e(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // value out of range - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::extents<signed char, D, 5> e(arg); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp deleted file mode 100644 index 90cb0c8..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// Test construction from array: -// -// template<class OtherIndexType, size_t N> -// constexpr explicit(N != rank_dynamic()) extents(const array<OtherIndexType, N>& exts) noexcept; -// -// Constraints: -// * is_convertible_v<const OtherIndexType&, index_type> is true, -// * is_nothrow_constructible_v<index_type, const OtherIndexType&> is true, and -// * N == rank_dynamic() || N == rank() is true. -// -// Preconditions: -// * If N != rank_dynamic() is true, exts[r] equals Er for each r for which -// Er is a static extent, and -// * either -// - N is zero, or -// - exts[r] is nonnegative and is representable as a value of type index_type -// for every rank index r. -// - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - // working case - { - [[maybe_unused]] std::extents<int, D, 5> e1(std::array{1000, 5}); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<int, D, 5> e1(std::array{1000, 3}); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // value out of range - { - TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<signed char, D, 5> e1(std::array{1000, 5}); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // negative value - { - TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<signed char, D, 5> e1(std::array{-1, 5}); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp deleted file mode 100644 index 37e79aa..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// Test construction from integral: -// -// template<class ... OtherIndexTypes> -// constexpr explicit extents(OtherIndexTypes ... exts) noexcept; -// -// Let N be sizeof...(OtherIndexTypes), and let -// exts_arr be array<index_type, N>{static_cast<index_type>(std::move(exts))...}. -// -// Constraints: -// * (is_convertible_v<OtherIndexTypes, index_type> && ...) is true, -// * (is_nothrow_constructible_v<index_type, OtherIndexType> && ...) is true, and -// * N == rank_dynamic() || N == rank() is true. -// -// Preconditions: -// * If N != rank_dynamic() is true, exts_arr[r] equals Er for each r for which -// Er is a static extent, and -// * either -// - sizeof...(exts) == 0 is true, or -// - each element of exts is nonnegative and is representable as a value of type index_type. -// - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - // working case - { - [[maybe_unused]] std::extents<int, D, 5> e1(1000, 5); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<int, D, 5> e1(1000, 3); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // value out of range - { - TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<signed char, D, 5> e1(1000, 5); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // negative value - { - TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<signed char, D, 5> e1(-1, 5); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp deleted file mode 100644 index 650fecf..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// Test construction from span: -// -// template<class OtherIndexType, size_t N> -// constexpr explicit(N != rank_dynamic()) extents(span<OtherIndexType, N> exts) noexcept; -// -// Constraints: -// * is_convertible_v<const OtherIndexType&, index_type> is true, -// * is_nothrow_constructible_v<index_type, const OtherIndexType&> is true, and -// * N == rank_dynamic() || N == rank() is true. -// -// Preconditions: -// * If N != rank_dynamic() is true, exts[r] equals Er for each r for which -// Er is a static extent, and -// * either -// - N is zero, or -// - exts[r] is nonnegative and is representable as a value of type index_type -// for every rank index r. -// - -#include <cassert> -#include <mdspan> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - // working case sanity check - { - std::array args{1000, 5}; - [[maybe_unused]] std::extents<int, D, 5> e1(std::span{args}); - } - // mismatch of static extent - { - std::array args{1000, 3}; - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::extents<int, D, 5> e1(std::span{args}); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // value out of range - { - std::array args{1000, 5}; - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::extents<signed char, D, 5> e1(std::span{args}); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // negative value - { - std::array args{-1, 5}; - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::extents<signed char, D, 5> e1(std::span{args}); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.obs.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.obs.pass.cpp deleted file mode 100644 index c473879..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/extents/assert.obs.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// static constexpr size_t static_extent(rank_type i) noexcept; -// -// Preconditions: i < rank() is true. -// -// Returns: Ei. -// -// -// constexpr index_type extent(rank_type i) const noexcept; -// -// Preconditions: i < rank() is true. -// -// Returns: Di. - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // mismatch of static extent - { - std::extents<int> e; - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.extent(0); }()), "extents access: index must be less than rank"); - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.static_extent(0); }()), "extents access: index must be less than rank"); - } - { - std::extents<int, D> e; - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.extent(2); }()), "extents access: index must be less than rank"); - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.static_extent(2); }()), "extents access: index must be less than rank"); - } - { - std::extents<int, 5> e; - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.extent(2); }()), "extents access: index must be less than rank"); - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.static_extent(2); }()), "extents access: index must be less than rank"); - } - { - std::extents<int, D, 5> e; - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.extent(2); }()), "extents access: index must be less than rank"); - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.static_extent(2); }()), "extents access: index must be less than rank"); - } - { - std::extents<int, 1, 2, 3, 4, 5, 6, 7, 8> e; - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.extent(9); }()), "extents access: index must be less than rank"); - TEST_LIBCPP_ASSERT_FAILURE(([=] { e.static_extent(9); }()), "extents access: index must be less than rank"); - } - - // check that static_extent works in constant expression with assertions enabled - static_assert(std::extents<int, D, 5>::static_extent(1) == 5); - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.conversion.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.conversion.pass.cpp deleted file mode 100644 index 7b6616f..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.conversion.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherExtents> -// constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) -// mapping(const mapping<OtherExtents>&) noexcept; - -// Constraints: is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: other.required_span_size() is representable as a value of type index_type. - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - std::extents<int, D, D> arg_exts{100, 5}; - std::layout_left::mapping<std::extents<int, D, D>> arg(arg_exts); - - // working case - { - [[maybe_unused]] std::layout_left::mapping<std::extents<size_t, D, 5>> m(arg); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_left::mapping<std::extents<int, D, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_left::mapping<std::extents<signed char, D>> m( - std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(500))); - }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // required_span_size not representable, while individual extents are - { - // check extents would be constructible - [[maybe_unused]] std::extents<signed char, D, 5> e(arg_exts); - // but the product is not, so we can't use it for layout_left - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_left::mapping<std::extents<signed char, D, 5>> m(arg); }()), - "layout_left::mapping converting ctor: other.required_span_size() must be representable as index_type."); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp deleted file mode 100644 index 7c96f8e..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// constexpr mapping(const extents_type& e) noexcept; -// -// Preconditions: The size of the multidimensional index space e is representable as a value of type index_type ([basic.fundamental]). -// -// Effects: Direct-non-list-initializes extents_ with e. - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // value out of range - { - // the extents are representable but the product is not, so we can't use it for layout_left - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_left::mapping<std::extents<signed char, D, 5>> m(std::extents<signed char, D, 5>(100)); }()), - "layout_left::mapping extents ctor: product of extents must be representable as index_type."); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp deleted file mode 100644 index e578bac..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherExtents> -// constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) -// mapping(const layout_right::mapping<OtherExtents>&) noexcept; - -// Constraints: -// - extents_type::rank() <= 1 is true, and -// - is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: other.required_span_size() is representable as a value of type index_type - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - std::extents<int, D> arg_exts{5}; - std::layout_right::mapping<std::extents<int, D>> arg(arg_exts); - - // working case - { - [[maybe_unused]] std::layout_left::mapping<std::extents<size_t, 5>> m(arg); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_left::mapping<std::extents<int, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_left::mapping<std::extents<signed char, D>> m( - std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(500))); - }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - - // Can't trigger required_span_size() representability assertion, since for rank-1 the above check will trigger first, - // and this conversion constructor is constrained on rank <= 1. - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp deleted file mode 100644 index cec8df8..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.ctor.layout_stride.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-ctad-maybe-unsupported - -// FIXME: https://github.com/llvm/llvm-project/issues/64719 -// There appear to be some issues around ctad which make it -// currently impossible to get this code warning free. -// Thus added the additional compile flag above - -// <mdspan> - -// template<class OtherExtents> -// constexpr explicit(extents_type::rank() > 0) -// mapping(const layout_stride::mapping<OtherExtents>& other); -// -// Constraints: is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: -// - If extents_type::rank() > 0 is true, then for all r in the range [0, extents_type::rank()), -// other.stride(r) equals other.extents().fwd-prod-of-extents(r), and -// - other.required_span_size() is representable as a value of type index_type ([basic.fundamental]). -// -// Effects: Direct-non-list-initializes extents_ with other.extents(). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // working case - { - std::layout_stride::mapping arg(std::extents<int, D>(5), std::array<int, 1>{1}); - [[maybe_unused]] std::layout_left::mapping<std::extents<size_t, 5>> m(arg); // should work - } - // mismatch of static extent - { - std::layout_stride::mapping arg(std::extents<int, D>(5), std::array<int, 1>{1}); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_left::mapping<std::extents<int, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - std::layout_stride::mapping arg(std::extents<int, D>(500), std::array<int, 1>{1}); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_left::mapping<std::extents<signed char, D>> m(arg); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // non-representability of required span size - { - std::layout_stride::mapping arg(std::extents<int, D, D>(100, 3), std::array<int, 2>{1, 100}); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_left::mapping<std::extents<signed char, D, D>> m(arg); }()), - "layout_left::mapping from layout_stride ctor: other.required_span_size() must be " - "representable as index_type."); - } - // strides are not layout_left compatible - { - std::layout_stride::mapping arg(std::extents<int, D>(5), std::array<int, 1>{2}); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_left::mapping<std::extents<size_t, 5>> m(arg); }()), - "layout_left::mapping from layout_stride ctor: strides are not compatible with layout_left."); - } - { - std::layout_stride::mapping arg(std::extents<int, D, D>(100, 3), std::array<int, 2>{2, 200}); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_left::mapping<std::extents<int, D, D>> m(arg); }()), - "layout_left::mapping from layout_stride ctor: strides are not compatible with layout_left."); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp deleted file mode 100644 index 79e424f..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class... Indices> -// constexpr index_type operator()(Indices... i) const noexcept; -// -// Constraints: -// - sizeof...(Indices) == extents_type::rank() is true, -// - (is_convertible_v<Indices, index_type> && ...) is true, and -// - (is_nothrow_constructible_v<index_type, Indices> && ...) is true. -// -// Preconditions: extents_type::index-cast(i) is a multidimensional index in extents_ ([mdspan.overview]). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - // value out of range - { - std::layout_left::mapping<std::extents<unsigned char, 5>> m; - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_left::mapping: out of bounds indexing"); - } - { - std::layout_left::mapping<std::extents<signed char, 5>> m; - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_left::mapping: out of bounds indexing"); - } - { - std::layout_left::mapping<std::dextents<unsigned char, 1>> m(std::dextents<unsigned char, 1>(5)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_left::mapping: out of bounds indexing"); - } - { - std::layout_left::mapping<std::dextents<signed char, 1>> m(std::dextents<signed char, 1>(5)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_left::mapping: out of bounds indexing"); - } - { - std::layout_left::mapping<std::dextents<int, 3>> m(std::dextents<int, 3>(5, 7, 9)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, -1, -1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, 0, 0), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, -1, 0), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, 0, -1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 3, 3), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 7, 3), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 3, 9), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 7, 9), "layout_left::mapping: out of bounds indexing"); - } - { - std::layout_left::mapping<std::dextents<unsigned, 3>> m(std::dextents<int, 3>(5, 7, 9)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, -1, -1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, 0, 0), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, -1, 0), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, 0, -1), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 3, 3), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 7, 3), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 3, 9), "layout_left::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 7, 9), "layout_left::mapping: out of bounds indexing"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.stride.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.stride.pass.cpp deleted file mode 100644 index 61a5149..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_left/assert.stride.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// layout_left::mapping -// -// constexpr index_type stride(rank_type i) const noexcept; -// -// Constraints: extents_type::rank() > 0 is true. -// -// Preconditions: i < extents_type::rank() is true. -// -// Returns: extents().rev-prod-of-extents(i). -// -// - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - // value out of range - { - std::layout_left::mapping<std::dextents<int, 3>> m{std::dextents<int, 3>{100, 100, 100}}; - - TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_left::mapping::stride(): invalid rank index"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.conversion.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.conversion.pass.cpp deleted file mode 100644 index df16edb..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.conversion.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherExtents> -// constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) -// mapping(const mapping<OtherExtents>&) noexcept; - -// Constraints: is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: other.required_span_size() is representable as a value of type index_type. - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - std::extents<int, D, D> arg_exts{100, 5}; - std::layout_right::mapping<std::extents<int, D, D>> arg(arg_exts); - - // working case - { - [[maybe_unused]] std::layout_right::mapping<std::extents<size_t, D, 5>> m(arg); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_right::mapping<std::extents<int, D, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_right::mapping<std::extents<signed char, D>> m( - std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(500))); - }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // required_span_size not representable, while individual extents are - { - // check extents would be constructible - [[maybe_unused]] std::extents<signed char, D, 5> e(arg_exts); - // but the product is not, so we can't use it for layout_right - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_right::mapping<std::extents<signed char, D, 5>> m(arg); }()), - "layout_right::mapping converting ctor: other.required_span_size() must be representable as index_type."); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp deleted file mode 100644 index 5209569..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// constexpr mapping(const extents_type& e) noexcept; -// -// Preconditions: The size of the multidimensional index space e is representable as a value of type index_type ([basic.fundamental]). -// -// Effects: Direct-non-list-initializes extents_ with e. - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // value out of range - { - // the extents are representable but the product is not, so we can't use it for layout_right - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_right::mapping<std::extents<signed char, D, 5>> m(std::extents<signed char, D, 5>(100)); - }()), - "layout_right::mapping extents ctor: product of extents must be representable as index_type."); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp deleted file mode 100644 index 1757ddb..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherExtents> -// constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) -// mapping(const layout_left::mapping<OtherExtents>&) noexcept; - -// Constraints: -// - extents_type::rank() <= 1 is true, and -// - is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: other.required_span_size() is representable as a value of type index_type - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - std::extents<int, D> arg_exts{5}; - std::layout_left::mapping<std::extents<int, D>> arg(arg_exts); - - // working case - { - [[maybe_unused]] std::layout_right::mapping<std::extents<size_t, 5>> m(arg); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_right::mapping<std::extents<int, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_right::mapping<std::extents<signed char, D>> m( - std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(500))); - }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - - // Can't trigger required_span_size() representability assertion, since for rank-1 the above check will trigger first, - // and this conversion constructor is constrained on rank <= 1. - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp deleted file mode 100644 index b77d964..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.ctor.layout_stride.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-ctad-maybe-unsupported - -// FIXME: https://github.com/llvm/llvm-project/issues/64719 -// There appear to be some issues around ctad which make it -// currently impossible to get this code warning free. -// Thus added the additional compile flag above - -// <mdspan> - -// template<class OtherExtents> -// constexpr explicit(extents_type::rank() > 0) -// mapping(const layout_stride::mapping<OtherExtents>& other); -// -// Constraints: is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: -// - If extents_type::rank() > 0 is true, then for all r in the range [0, extents_type::rank()), -// other.stride(r) equals other.extents().fwd-prod-of-extents(r), and -// - other.required_span_size() is representable as a value of type index_type ([basic.fundamental]). -// -// Effects: Direct-non-list-initializes extents_ with other.extents(). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // working case - { - std::layout_stride::mapping arg(std::extents<int, D>(5), std::array<int, 1>{1}); - [[maybe_unused]] std::layout_right::mapping<std::extents<size_t, 5>> m(arg); // should work - } - // mismatch of static extent - { - std::layout_stride::mapping arg(std::extents<int, D>(5), std::array<int, 1>{1}); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_right::mapping<std::extents<int, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - std::layout_stride::mapping arg(std::extents<int, D>(500), std::array<int, 1>{1}); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_right::mapping<std::extents<signed char, D>> m(arg); }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // non-representability of required span size - { - std::layout_stride::mapping arg(std::extents<int, D, D>(100, 3), std::array<int, 2>{3, 1}); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_right::mapping<std::extents<signed char, D, D>> m(arg); }()), - "layout_right::mapping from layout_stride ctor: other.required_span_size() must be " - "representable as index_type."); - } - // strides are not layout_right compatible - { - std::layout_stride::mapping arg(std::extents<int, D>(5), std::array<int, 1>{2}); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_right::mapping<std::extents<size_t, 5>> m(arg); }()), - "layout_right::mapping from layout_stride ctor: strides are not compatible with layout_right."); - } - { - std::layout_stride::mapping arg(std::extents<int, D, D>(100, 3), std::array<int, 2>{6, 2}); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_right::mapping<std::extents<int, D, D>> m(arg); }()), - "layout_right::mapping from layout_stride ctor: strides are not compatible with layout_right."); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp deleted file mode 100644 index 7fae6f8..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class... Indices> -// constexpr index_type operator()(Indices... i) const noexcept; -// -// Constraints: -// - sizeof...(Indices) == extents_type::rank() is true, -// - (is_convertible_v<Indices, index_type> && ...) is true, and -// - (is_nothrow_constructible_v<index_type, Indices> && ...) is true. -// -// Preconditions: extents_type::index-cast(i) is a multidimensional index in extents_ ([mdspan.overview]). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - // value out of range - { - std::layout_right::mapping<std::extents<unsigned char, 5>> m; - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_right::mapping: out of bounds indexing"); - } - { - std::layout_right::mapping<std::extents<signed char, 5>> m; - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_right::mapping: out of bounds indexing"); - } - { - std::layout_right::mapping<std::dextents<unsigned char, 1>> m(std::dextents<unsigned char, 1>(5)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_right::mapping: out of bounds indexing"); - } - { - std::layout_right::mapping<std::dextents<signed char, 1>> m(std::dextents<signed char, 1>(5)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_right::mapping: out of bounds indexing"); - } - { - std::layout_right::mapping<std::dextents<int, 3>> m(std::dextents<int, 3>(5, 7, 9)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, -1, -1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, 0, 0), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, -1, 0), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, 0, -1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 3, 3), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 7, 3), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 3, 9), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 7, 9), "layout_right::mapping: out of bounds indexing"); - } - { - std::layout_right::mapping<std::dextents<unsigned, 3>> m(std::dextents<int, 3>(5, 7, 9)); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, -1, -1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, 0, 0), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, -1, 0), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, 0, -1), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 3, 3), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 7, 3), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 3, 9), "layout_right::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 7, 9), "layout_right::mapping: out of bounds indexing"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.stride.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.stride.pass.cpp deleted file mode 100644 index 8e3049c4..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_right/assert.stride.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// layout_right::mapping -// -// constexpr index_type stride(rank_type i) const noexcept; -// -// Constraints: extents_type::rank() > 0 is true. -// -// Preconditions: i < extents_type::rank() is true. -// -// Returns: extents().rev-prod-of-extents(i). -// -// - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - // value out of range - { - std::layout_right::mapping<std::dextents<int, 3>> m{std::dextents<int, 3>{100, 100, 100}}; - - TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_right::mapping::stride(): invalid rank index"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp deleted file mode 100644 index 7deb121..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.conversion.pass.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// XFAIL: libcpp-hardening-mode=debug && target=powerpc{{.*}}le-unknown-linux-gnu - -// <mdspan> - -// template<class StridedLayoutMapping> -// constexpr explicit(see below) -// mapping(const StridedLayoutMapping& other) noexcept; -// -// Constraints: -// - layout-mapping-alike<StridedLayoutMapping> is satisfied. -// - is_constructible_v<extents_type, typename StridedLayoutMapping::extents_type> is true. -// - StridedLayoutMapping::is_always_unique() is true. -// - StridedLayoutMapping::is_always_strided() is true. -// -// Preconditions: -// - StridedLayoutMapping meets the layout mapping requirements ([mdspan.layout.policy.reqmts]), -// - other.stride(r) > 0 is true for every rank index r of extents(), -// - other.required_span_size() is representable as a value of type index_type ([basic.fundamental]), and -// - OFFSET(other) == 0 is true. -// -// Effects: Direct-non-list-initializes extents_ with other.extents(), and for all d in the range [0, rank_), -// direct-non-list-initializes strides_[d] with other.stride(d). -// -// Remarks: The expression inside explicit is equivalent to: -// - !(is_convertible_v<typename StridedLayoutMapping::extents_type, extents_type> && -// (is-mapping-of<layout_left, LayoutStrideMapping> || -// is-mapping-of<layout_right, LayoutStrideMapping> || -// is-mapping-of<layout_stride, LayoutStrideMapping>)) - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" -#include "../../../../../std/containers/views/mdspan/CustomTestLayouts.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // working case - { - std::extents<int, D, D> arg_exts{100, 5}; - std::layout_stride::mapping<std::extents<int, D, D>> arg(arg_exts, std::array<int, 2>{1, 100}); - [[maybe_unused]] std::layout_stride::mapping<std::extents<size_t, D, 5>> m(arg); // should work - } - // mismatch of static extent - { - std::extents<int, D, D> arg_exts{100, 5}; - std::layout_stride::mapping<std::extents<int, D, D>> arg(arg_exts, std::array<int, 2>{1, 100}); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_stride::mapping<std::extents<int, D, 3>> m(arg); }()), - "extents construction: mismatch of provided arguments with static extents."); - } - // non-representability of extents itself - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<signed char, D>> m( - std::layout_stride::mapping<std::extents<int, D>>(std::extents<int, D>(500), std::array<int, 1>{1})); - }()), - "extents ctor: arguments must be representable as index_type and nonnegative"); - } - // all strides must be larger than zero - { - always_convertible_layout::mapping<std::dextents<int, 2>> offset_map(std::dextents<int, 2>{10, 10}, 100, -1); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_stride::mapping<std::extents<signed char, D, D>> m(offset_map); }()), - "layout_stride::mapping converting ctor: all strides must be greater than 0"); - } - // required_span_size not representable, while individual extents are - { - std::extents<int, D, D> arg_exts{100, 5}; - std::layout_stride::mapping<std::extents<int, D, D>> arg(arg_exts, std::array<int, 2>{1, 100}); - // check extents would be constructible - [[maybe_unused]] std::extents<signed char, D, 5> e(arg_exts); - // but the product is not, so we can't use it for layout_stride - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_stride::mapping<std::extents<signed char, D, 5>> m(arg); }()), - "layout_stride::mapping converting ctor: other.required_span_size() must be representable as index_type."); - } - // required_span_size not representable, while individual extents are, edge case - { - // required span size = (3-1)*50 + (10-1) * 3 + 1 = 128 - std::extents<int, D, D> arg_exts{3, 10}; - std::layout_stride::mapping<std::extents<int, D, D>> arg(arg_exts, std::array<int, 2>{50, 3}); - // sanity check: - assert(arg.required_span_size() == 128); - // check extents would be constructible - [[maybe_unused]] std::extents<signed char, D, 10> e(arg_exts); - // but the product is not, so we can't use it for layout_stride - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::layout_stride::mapping<std::extents<signed char, D, 10>> m(arg); }()), - "layout_stride::mapping converting ctor: other.required_span_size() must be representable as index_type."); - } - // base offset must be 0 (i.e. mapping(0,...,0)==0) for a strided layout with positive strides - { - always_convertible_layout::mapping<std::dextents<int, 2>> offset_map(std::dextents<int, 2>{10, 10}, 3); - TEST_LIBCPP_ASSERT_FAILURE(([=] { std::layout_stride::mapping<std::extents<signed char, D, D>> m(offset_map); }()), - "layout_stride::mapping converting ctor: base offset of mapping must be zero."); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_array.non_unique.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_array.non_unique.pass.cpp deleted file mode 100644 index 97a6d56..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_array.non_unique.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherIndexType> -// constexpr mapping(const extents_type& e, const array<OtherIndexType, rank_>& s) noexcept; -// -// Constraints: -// - is_convertible_v<const OtherIndexType&, index_type> is true, and -// - is_nothrow_constructible_v<index_type, const OtherIndexType&> is true. -// -// Preconditions: -// - s[i] > 0 is true for all i in the range [0, rank_). -// - REQUIRED-SPAN-SIZE(e, s) is representable as a value of type index_type ([basic.fundamental]). -// - If rank_ is greater than 0, then there exists a permutation P of the integers in the range [0, rank_), -// such that s[pi] >= s[pi_1] * e.extent(pi_1) is true for all i in the range [1, rank_), where -// pi is the ith element of P. -// [Note 1: For layout_stride, this condition is necessary and sufficient for is_unique() to be true. end note] -// -// Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] with as_const(s[d]). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // overlapping strides - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<unsigned, D, 5, 7>> m( - std::extents<unsigned, D, 5, 7>(20), std::array<unsigned, 3>{4, 1, 200}); - }()), - "layout_stride::mapping ctor: the provided extents and strides lead to a non-unique mapping"); - } - // equal strides - { - // should work because one of the equal strides is associated with an extent of 1 - [[maybe_unused]] std::layout_stride::mapping<std::extents<unsigned, D, 5, 1>> m1( - std::extents<unsigned, D, 5, 1>(2), std::array<unsigned, 3>{5, 1, 5}); - [[maybe_unused]] std::layout_stride::mapping<std::extents<unsigned, D, 5, 2>> m2( - std::extents<unsigned, D, 5, 2>(1), std::array<unsigned, 3>{5, 1, 5}); - - // will fail because neither of the equal strides is associated with an extent of 1 - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<unsigned, D, 5, 2>> m3( - std::extents<unsigned, D, 5, 2>(2), std::array<unsigned, 3>{5, 1, 5}); - }()), - "layout_stride::mapping ctor: the provided extents and strides lead to a non-unique mapping"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp deleted file mode 100644 index 860849d..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_array.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherIndexType> -// constexpr mapping(const extents_type& e, const array<OtherIndexType, rank_>& s) noexcept; -// -// Constraints: -// - is_convertible_v<const OtherIndexType&, index_type> is true, and -// - is_nothrow_constructible_v<index_type, const OtherIndexType&> is true. -// -// Preconditions: -// - s[i] > 0 is true for all i in the range [0, rank_). -// - REQUIRED-SPAN-SIZE(e, s) is representable as a value of type index_type ([basic.fundamental]). -// - If rank_ is greater than 0, then there exists a permutation P of the integers in the range [0, rank_), -// such that s[pi] >= s[pi_1] * e.extent(pi_1) is true for all i in the range [1, rank_), where -// pi is the ith element of P. -// [Note 1: For layout_stride, this condition is necessary and sufficient for is_unique() to be true. end note] -// -// Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] with as_const(s[d]). - -#include <cassert> -#include <mdspan> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // the extents are representable but the product with strides is not, so we can't use it for layout_stride - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<signed char, D, 5>> m( - std::extents<signed char, D, 5>(20), std::array<int, 2>{20, 1}); - }()), - "layout_stride::mapping ctor: required span size is not representable as index_type."); - - // check that if we first overflow in strides conversion we also fail - static_assert(static_cast<unsigned char>(257u) == 1); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<unsigned char, D, 5>> m( - std::extents<unsigned char, D, 5>(20), std::array<unsigned, 2>{257, 1}); - }()), - "layout_stride::mapping ctor: required span size is not representable as index_type."); - - // negative strides are not allowed, check with unsigned index_type so we make sure we catch that - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<unsigned, D, 5>> m( - std::extents<unsigned, D, 5>(20), std::array<int, 2>{20, -1}); - }()), - "layout_stride::mapping ctor: all strides must be greater than 0"); - // zero strides are not allowed, check with unsigned index_type so we make sure we catch that - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<unsigned, D, 5>> m( - std::extents<unsigned, D, 5>(20), std::array<unsigned, 2>{20, 0}); - }()), - "layout_stride::mapping ctor: all strides must be greater than 0"); - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_span.non_unique.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_span.non_unique.pass.cpp deleted file mode 100644 index fd0701e..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_span.non_unique.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherIndexType> -// constexpr mapping(const extents_type& e, span<OtherIndexType, rank_> s) noexcept; -// -// Constraints: -// - is_convertible_v<const OtherIndexType&, index_type> is true, and -// - is_nothrow_constructible_v<index_type, const OtherIndexType&> is true. -// -// Preconditions: -// - s[i] > 0 is true for all i in the range [0, rank_). -// - REQUIRED-SPAN-SIZE(e, s) is representable as a value of type index_type ([basic.fundamental]). -// - If rank_ is greater than 0, then there exists a permutation P of the integers in the range [0, rank_), -// such that s[pi] >= s[pi_1] * e.extent(pi_1) is true for all i in the range [1, rank_), where -// pi is the ith element of P. -// [Note 1: For layout_stride, this condition is necessary and sufficient for is_unique() to be true. end note] -// -// Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] with as_const(s[d]). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // overlapping strides - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::array<unsigned, 3> strides{4, 1, 200}; - std::layout_stride::mapping<std::extents<unsigned, D, 5, 7>> m( - std::extents<unsigned, D, 5, 7>(20), std::span(strides)); - }()), - "layout_stride::mapping ctor: the provided extents and strides lead to a non-unique mapping"); - } - - // equal strides - { - // should work because one of the equal strides is associated with an extent of 1 - std::array<unsigned, 3> strides{5, 1, 5}; - [[maybe_unused]] std::layout_stride::mapping<std::extents<unsigned, D, 5, 1>> m1( - std::extents<unsigned, D, 5, 1>(2), std::span(strides)); - [[maybe_unused]] std::layout_stride::mapping<std::extents<unsigned, D, 5, 2>> m2( - std::extents<unsigned, D, 5, 2>(1), std::span(strides)); - - // will fail because neither of the equal strides is associated with an extent of 1 - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::layout_stride::mapping<std::extents<unsigned, D, 5, 2>> m3( - std::extents<unsigned, D, 5, 2>(2), std::span(strides)); - }()), - "layout_stride::mapping ctor: the provided extents and strides lead to a non-unique mapping"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp deleted file mode 100644 index 70ab061..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.ctor.extents_span.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherIndexType> -// constexpr mapping(const extents_type& e, span<OtherIndexType, rank_> s) noexcept; -// -// Constraints: -// - is_convertible_v<const OtherIndexType&, index_type> is true, and -// - is_nothrow_constructible_v<index_type, const OtherIndexType&> is true. -// -// Preconditions: -// - s[i] > 0 is true for all i in the range [0, rank_). -// - REQUIRED-SPAN-SIZE(e, s) is representable as a value of type index_type ([basic.fundamental]). -// - If rank_ is greater than 0, then there exists a permutation P of the integers in the range [0, rank_), -// such that s[pi] >= s[pi_1] * e.extent(pi_1) is true for all i in the range [1, rank_), where -// pi is the ith element of P. -// [Note 1: For layout_stride, this condition is necessary and sufficient for is_unique() to be true. end note] -// -// Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] with as_const(s[d]). - -#include <cassert> -#include <mdspan> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - - // value out of range - { - // the extents are representable but the product with strides is not, so we can't use it for layout_stride - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::array<int, 2> strides{20, 1}; - std::layout_stride::mapping<std::extents<signed char, D, 5>> m( - std::extents<signed char, D, 5>(20), std::span(strides)); - }()), - "layout_stride::mapping ctor: required span size is not representable as index_type."); - - // check that if we first overflow in strides conversion we also fail - static_assert(static_cast<unsigned char>(257u) == 1); - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::array<unsigned, 2> strides{257, 1}; - std::layout_stride::mapping<std::extents<unsigned char, D, 5>> m( - std::extents<unsigned char, D, 5>(20), std::span(strides)); - }()), - "layout_stride::mapping ctor: required span size is not representable as index_type."); - - // negative strides are not allowed, check with unsigned index_type so we make sure we catch that - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::array<int, 2> strides{20, -1}; - std::layout_stride::mapping<std::extents<unsigned, D, 5>> m( - std::extents<unsigned, D, 5>(20), std::span(strides)); - }()), - "layout_stride::mapping ctor: all strides must be greater than 0"); - // zero strides are not allowed, check with unsigned index_type so we make sure we catch that - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { - std::array<unsigned, 2> strides{20, 0}; - std::layout_stride::mapping<std::extents<unsigned, D, 5>> m( - std::extents<unsigned, D, 5>(20), std::span(strides)); - }()), - "layout_stride::mapping ctor: all strides must be greater than 0"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.index_operator.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.index_operator.pass.cpp deleted file mode 100644 index b5244a6..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.index_operator.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class... Indices> -// constexpr index_type operator()(Indices... i) const noexcept; -// -// Constraints: -// - sizeof...(Indices) == extents_type::rank() is true, -// - (is_convertible_v<Indices, index_type> && ...) is true, and -// - (is_nothrow_constructible_v<index_type, Indices> && ...) is true. -// -// Preconditions: extents_type::index-cast(i) is a multidimensional index in extents_ ([mdspan.overview]). - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - // value out of range - { - std::layout_stride::mapping<std::extents<unsigned char, 5>> m; - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_stride::mapping: out of bounds indexing"); - } - { - std::layout_stride::mapping<std::extents<signed char, 5>> m; - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_stride::mapping: out of bounds indexing"); - } - { - std::layout_stride::mapping<std::dextents<unsigned char, 1>> m( - std::dextents<unsigned char, 1>(5), std::array<int, 1>{1}); - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_stride::mapping: out of bounds indexing"); - } - { - std::layout_stride::mapping<std::dextents<signed char, 1>> m( - std::dextents<signed char, 1>(5), std::array<int, 1>{1}); - TEST_LIBCPP_ASSERT_FAILURE(m(-1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-130), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(1000), "layout_stride::mapping: out of bounds indexing"); - } - { - std::layout_stride::mapping<std::dextents<int, 3>> m( - std::dextents<int, 3>(5, 7, 9), std::array<int, 3>{1, 10, 100}); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, -1, -1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, 0, 0), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, -1, 0), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, 0, -1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 3, 3), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 7, 3), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 3, 9), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 7, 9), "layout_stride::mapping: out of bounds indexing"); - } - { - std::layout_stride::mapping<std::dextents<unsigned, 3>> m( - std::dextents<int, 3>(5, 7, 9), std::array<int, 3>{1, 10, 100}); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, -1, -1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(-1, 0, 0), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, -1, 0), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(0, 0, -1), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 3, 3), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 7, 3), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(3, 3, 9), "layout_stride::mapping: out of bounds indexing"); - TEST_LIBCPP_ASSERT_FAILURE(m(5, 7, 9), "layout_stride::mapping: out of bounds indexing"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.stride.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.stride.pass.cpp deleted file mode 100644 index ee2b731..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/layout_stride/assert.stride.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// constexpr index_type stride(rank_type i) const noexcept { return strides_[i]; } - -// We intercept this inside layout_stride to give a consistent error message with -// layout_left and layout_right, technically the precondition is coming from the -// array access. - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - // value out of range - { - std::layout_stride::mapping<std::dextents<int, 3>> m( - std::dextents<int, 3>(100, 100, 100), std::array<int, 3>{1, 100, 10000}); - - TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_stride::mapping::stride(): invalid rank index"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.conversion.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.conversion.pass.cpp deleted file mode 100644 index 53aec7b..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.conversion.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class OtherElementType, class OtherExtents, -// class OtherLayoutPolicy, class OtherAccessor> -// constexpr explicit(see below) -// mdspan(const mdspan<OtherElementType, OtherExtents, -// OtherLayoutPolicy, OtherAccessor>& other); -// -// Constraints: -// - is_constructible_v<mapping_type, const OtherLayoutPolicy::template mapping<OtherExtents>&> is true, and -// - is_constructible_v<accessor_type, const OtherAccessor&> is true. -// Mandates: -// - is_constructible_v<data_handle_type, const OtherAccessor::data_handle_type&> is -// - is_constructible_v<extents_type, OtherExtents> is true. -// -// Preconditions: -// - For each rank index r of extents_type, static_extent(r) == dynamic_extent || static_extent(r) == other.extent(r) is true. -// - [0, map_.required_span_size()) is an accessible range of ptr_ and acc_ for values of ptr_, map_, and acc_ after the invocation of this constructor. -// -// Effects: -// - Direct-non-list-initializes ptr_ with other.ptr_, -// - direct-non-list-initializes map_ with other.map_, and -// - direct-non-list-initializes acc_ with other.acc_. -// -// Remarks: The expression inside explicit is equivalent to: -// !is_convertible_v<const OtherLayoutPolicy::template mapping<OtherExtents>&, mapping_type> -// || !is_convertible_v<const OtherAccessor&, accessor_type> - -#include <array> -#include <cassert> -#include <mdspan> - -#include "check_assertion.h" -#include "../../../../../std/containers/views/mdspan/CustomTestLayouts.h" - -// We use a funky mapping in this test that doesn't check the dynamic/static extents mismatch itself -int main(int, char**) { - constexpr size_t D = std::dynamic_extent; - std::array<float, 10> data; - layout_wrapping_integral<4>::mapping<std::dextents<int, 2>> src_map( - std::dextents<int, 2>(5, 2), not_extents_constructible_tag()); - std::mdspan<float, std::dextents<int, 2>, layout_wrapping_integral<4>> arg(data.data(), src_map); - - // working case - { - [[maybe_unused]] std::mdspan<float, std::extents<size_t, D, 2>, layout_wrapping_integral<4>> m(arg); // should work - } - // mismatch of static extent - { - TEST_LIBCPP_ASSERT_FAILURE( - ([=] { std::mdspan<float, std::extents<size_t, D, 3>, layout_wrapping_integral<4>> m(arg); }()), - "mdspan: conversion mismatch of source dynamic extents with static extents"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp deleted file mode 100644 index 9dd9579..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// template<class... OtherIndexTypes> -// constexpr reference operator[](OtherIndexTypes... indices) const; -// Constraints: -// - (is_convertible_v<OtherIndexTypes, index_type> && ...) is true, -// - (is_nothrow_constructible_v<index_type, OtherIndexTypes> && ...) is true, and -// - sizeof...(OtherIndexTypes) == rank() is true. -// -// Let I be extents_type::index-cast(std::move(indices)). -// -// Preconditions: I is a multidimensional index in extents(). -// Note 1: This implies that map_(I) < map_.required_span_size() is true. -// -// Effects: Equivalent to: -// return acc_.access(ptr_, map_(static_cast<index_type>(std::move(indices))...)); - -#include <mdspan> -#include <cassert> - -#include "check_assertion.h" - -int main(int, char**) { - float data[1024]; - // value out of range - { - std::mdspan m(data, std::extents<unsigned char, 5>()); - TEST_LIBCPP_ASSERT_FAILURE(m[-1], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[-130], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[5], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[1000], "mdspan: operator[] out of bounds access"); - } - { - std::mdspan m(data, std::extents<signed char, 5>()); - TEST_LIBCPP_ASSERT_FAILURE(m[-1], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[-130], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[5], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[1000], "mdspan: operator[] out of bounds access"); - } - { - std::mdspan m(data, std::dextents<unsigned char, 1>(5)); - TEST_LIBCPP_ASSERT_FAILURE(m[-1], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[-130], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[5], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[1000], "mdspan: operator[] out of bounds access"); - } - { - std::mdspan m(data, std::dextents<signed char, 1>(5)); - TEST_LIBCPP_ASSERT_FAILURE(m[-1], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[-130], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[5], "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE(m[1000], "mdspan: operator[] out of bounds access"); - } - { - std::mdspan m(data, std::dextents<int, 3>(5, 7, 9)); - TEST_LIBCPP_ASSERT_FAILURE((m[-1, -1, -1]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[-1, 0, 0]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[0, -1, 0]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[0, 0, -1]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[5, 3, 3]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[3, 7, 3]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[3, 3, 9]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[5, 7, 9]), "mdspan: operator[] out of bounds access"); - } - { - std::mdspan m(data, std::dextents<unsigned, 3>(5, 7, 9)); - TEST_LIBCPP_ASSERT_FAILURE((m[-1, -1, -1]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[-1, 0, 0]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[0, -1, 0]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[0, 0, -1]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[5, 3, 3]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[3, 7, 3]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[3, 3, 9]), "mdspan: operator[] out of bounds access"); - TEST_LIBCPP_ASSERT_FAILURE((m[5, 7, 9]), "mdspan: operator[] out of bounds access"); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.size.pass.cpp b/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.size.pass.cpp deleted file mode 100644 index 9af8270..0000000 --- a/libcxx/test/libcxx-03/containers/views/mdspan/mdspan/assert.size.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -// 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 -// -//===----------------------------------------------------------------------===// -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <mdspan> - -// constexpr size_type size() const noexcept; -// -// Preconditions: The size of the multidimensional index space extents() is representable as a value of type size_type ([basic.fundamental]). -// -// Returns: extents().fwd-prod-of-extents(rank()). - -#include <array> -#include <cassert> -#include <mdspan> - -#include "check_assertion.h" -#include "../../../../../std/containers/views/mdspan/CustomTestLayouts.h" - -// We use a funky mapping in this test where required_span_size is much smaller than the size of the index space -int main(int, char**) { - std::array<float, 10> data; - // make sure we are not failing because of using index_type instead of size_type - { - layout_wrapping_integral<4>::mapping<std::dextents<signed char, 2>> map( - std::dextents<signed char, 2>(100, 2), not_extents_constructible_tag()); - std::mdspan<float, std::dextents<signed char, 2>, layout_wrapping_integral<4>> mds(data.data(), map); - assert(map.required_span_size() == static_cast<signed char>(8)); - assert((static_cast<unsigned char>(200) == mds.size())); - } - { - layout_wrapping_integral<4>::mapping<std::dextents<signed char, 2>> map( - std::dextents<signed char, 2>(100, 3), not_extents_constructible_tag()); - std::mdspan<float, std::dextents<signed char, 2>, layout_wrapping_integral<4>> mds(data.data(), map); - // sanity check - assert(map.required_span_size() == static_cast<signed char>(12)); - // 100 x 3 exceeds 256 - { - TEST_LIBCPP_ASSERT_FAILURE(([=] { mds.size(); }()), "mdspan: size() is not representable as size_type"); - } - } - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/assert.iterator-indexing.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/assert.iterator-indexing.pass.cpp deleted file mode 100644 index d4dacb1..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/assert.iterator-indexing.pass.cpp +++ /dev/null @@ -1,174 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Make sure that std::span's iterators check for OOB accesses when the debug mode is enabled. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators -// UNSUPPORTED: libcpp-hardening-mode=none - -#include <span> - -#include "check_assertion.h" - -struct Foo { - int x; -}; - -template <typename Iter> -void test_iterator(Iter begin, Iter end, bool reverse) { - std::ptrdiff_t distance = std::distance(begin, end); - - // Dereferencing an iterator at the end. - { - TEST_LIBCPP_ASSERT_FAILURE( - *end, - reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); -#if _LIBCPP_STD_VER >= 20 - // In C++20 mode, std::reverse_iterator implements operator->, but not operator*, with - // std::prev instead of operator--. std::prev ultimately calls operator+ - TEST_LIBCPP_ASSERT_FAILURE( - end->x, - reverse ? "__bounded_iter::operator+=: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator->: Attempt to dereference an iterator at the end"); -#else - TEST_LIBCPP_ASSERT_FAILURE( - end->x, - reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator->: Attempt to dereference an iterator at the end"); -#endif - } - - // Incrementing an iterator past the end. - { - [[maybe_unused]] const char* msg = - reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator++: Attempt to advance an iterator past the end"; - auto it = end; - TEST_LIBCPP_ASSERT_FAILURE(it++, msg); - TEST_LIBCPP_ASSERT_FAILURE(++it, msg); - } - - // Decrementing an iterator past the start. - { - [[maybe_unused]] const char* msg = - reverse ? "__bounded_iter::operator++: Attempt to advance an iterator past the end" - : "__bounded_iter::operator--: Attempt to rewind an iterator past the start"; - auto it = begin; - TEST_LIBCPP_ASSERT_FAILURE(it--, msg); - TEST_LIBCPP_ASSERT_FAILURE(--it, msg); - } - - // Advancing past the end with operator+= and operator+. - { - [[maybe_unused]] const char* msg = - reverse ? "__bounded_iter::operator-=: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator+=: Attempt to advance an iterator past the end"; - auto it = end; - TEST_LIBCPP_ASSERT_FAILURE(it += 1, msg); - TEST_LIBCPP_ASSERT_FAILURE(end + 1, msg); - it = begin; - TEST_LIBCPP_ASSERT_FAILURE(it += (distance + 1), msg); - TEST_LIBCPP_ASSERT_FAILURE(begin + (distance + 1), msg); - } - - // Advancing past the end with operator-= and operator-. - { - [[maybe_unused]] const char* msg = - reverse ? "__bounded_iter::operator+=: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator-=: Attempt to advance an iterator past the end"; - auto it = end; - TEST_LIBCPP_ASSERT_FAILURE(it -= (-1), msg); - TEST_LIBCPP_ASSERT_FAILURE(end - (-1), msg); - it = begin; - TEST_LIBCPP_ASSERT_FAILURE(it -= (-distance - 1), msg); - TEST_LIBCPP_ASSERT_FAILURE(begin - (-distance - 1), msg); - } - - // Rewinding past the start with operator+= and operator+. - { - [[maybe_unused]] const char* msg = - reverse ? "__bounded_iter::operator-=: Attempt to advance an iterator past the end" - : "__bounded_iter::operator+=: Attempt to rewind an iterator past the start"; - auto it = begin; - TEST_LIBCPP_ASSERT_FAILURE(it += (-1), msg); - TEST_LIBCPP_ASSERT_FAILURE(begin + (-1), msg); - it = end; - TEST_LIBCPP_ASSERT_FAILURE(it += (-distance - 1), msg); - TEST_LIBCPP_ASSERT_FAILURE(end + (-distance - 1), msg); - } - - // Rewinding past the start with operator-= and operator-. - { - [[maybe_unused]] const char* msg = - reverse ? "__bounded_iter::operator+=: Attempt to advance an iterator past the end" - : "__bounded_iter::operator-=: Attempt to rewind an iterator past the start"; - auto it = begin; - TEST_LIBCPP_ASSERT_FAILURE(it -= 1, msg); - TEST_LIBCPP_ASSERT_FAILURE(begin - 1, msg); - it = end; - TEST_LIBCPP_ASSERT_FAILURE(it -= (distance + 1), msg); - TEST_LIBCPP_ASSERT_FAILURE(end - (distance + 1), msg); - } - - // Out-of-bounds operator[]. - { - [[maybe_unused]] const char* end_msg = - reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"; - [[maybe_unused]] const char* past_end_msg = - reverse ? "__bounded_iter::operator-=: Attempt to rewind an iterator past the start" - : "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"; - [[maybe_unused]] const char* past_start_msg = - reverse ? "__bounded_iter::operator-=: Attempt to advance an iterator past the end" - : "__bounded_iter::operator[]: Attempt to index an iterator past the start"; - TEST_LIBCPP_ASSERT_FAILURE(begin[distance], end_msg); - TEST_LIBCPP_ASSERT_FAILURE(begin[distance + 1], past_end_msg); - TEST_LIBCPP_ASSERT_FAILURE(begin[-1], past_start_msg); - TEST_LIBCPP_ASSERT_FAILURE(begin[-99], past_start_msg); - - auto it = begin + 1; - TEST_LIBCPP_ASSERT_FAILURE(it[distance - 1], end_msg); - TEST_LIBCPP_ASSERT_FAILURE(it[distance], past_end_msg); - TEST_LIBCPP_ASSERT_FAILURE(it[-2], past_start_msg); - TEST_LIBCPP_ASSERT_FAILURE(it[-99], past_start_msg); - } -} - -int main(int, char**) { - // span<T>::iterator - { - Foo array[] = {{0}, {1}, {2}}; - std::span<Foo> const span(array, 3); - test_iterator(span.begin(), span.end(), /*reverse=*/false); - } - - // span<T, N>::iterator - { - Foo array[] = {{0}, {1}, {2}}; - std::span<Foo, 3> const span(array, 3); - test_iterator(span.begin(), span.end(), /*reverse=*/false); - } - - // span<T>::reverse_iterator - { - Foo array[] = {{0}, {1}, {2}}; - std::span<Foo> const span(array, 3); - test_iterator(span.rbegin(), span.rend(), /*reverse=*/true); - } - - // span<T, N>::reverse_iterator - { - Foo array[] = {{0}, {1}, {2}}; - std::span<Foo, 3> const span(array, 3); - test_iterator(span.rbegin(), span.rend(), /*reverse=*/true); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp deleted file mode 100644 index 64e3cc8..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr span<T, Extent>::span(Iterator it, Sentinel sent); -// -// Check that we ensure `Extent == sent - it` and also that `[it, sent)` is a valid range. -// -// -// constexpr span<T, dynamic_extent>::span(Iterator it, Sentinel sent); -// -// Check that we ensure that `[it, sent)` is a valid range. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - - auto invalid_range = [&] { - std::span<int> const s(array.end(), array.begin()); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(invalid_range(), "invalid range in span's constructor (iterator, sentinel)"); - } - { - std::array<int, 3> array{0, 1, 2}; - - auto invalid_range = [&] { - std::span<int, 3> const s(array.end(), array.begin()); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(invalid_range(), "invalid range in span's constructor (iterator, sentinel)"); - - auto invalid_size = [&] { - std::span<int, 3> const s(array.begin(), array.begin() + 2); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE( - invalid_size(), "invalid range in span's constructor (iterator, sentinel): last - first != extent"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.iter_size.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.iter_size.pass.cpp deleted file mode 100644 index c8c6e374..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.iter_size.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr span<T, Extent>::span(Iterator, size_type); -// -// Check that the passed size is equal to the statically known extent. -// Note that it doesn't make sense to validate the incoming size in the -// dynamic_extent version. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - std::array<int, 3> array{0, 1, 2}; - - // Input range too large (exceeds the span extent) - { - auto f = [&] { - std::span<int, 3> const s(array.data(), 4); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(f(), "size mismatch in span's constructor (iterator, len)"); - } - - // Input range too small (doesn't fill the span) - { - auto f = [&] { - std::span<int, 3> const s(array.data(), 2); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(f(), "size mismatch in span's constructor (iterator, len)"); - } - - // Input range is non-empty but starts with a null pointer - { - // static extent - { - auto f = [&] { - int* p = nullptr; - std::span<int, 3> const s(p, 3); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(f(), "passed nullptr with non-zero length in span's constructor (iterator, len)"); - } - - // dynamic extent - { - auto f = [&] { - int* p = nullptr; - std::span<int, std::dynamic_extent> const s(p, 1); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(f(), "passed nullptr with non-zero length in span's constructor (iterator, len)"); - } - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.other_span.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.other_span.pass.cpp deleted file mode 100644 index 9a4e65b0..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.other_span.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr span<T, Extent>::span(const span<U, dynamic_extent>& other); -// -// Check that we ensure `other.size() == Extent`. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - std::array<int, 3> array{0, 1, 2}; - std::span<int> other(array.data(), 3); - - auto invalid_source = [&] { - std::span<int, 2> const s(other); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(invalid_source(), "size mismatch in span's constructor (other span)"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.range.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.range.pass.cpp deleted file mode 100644 index 5e36e9a..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.cons/assert.range.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr span<T, Extent>::span(Range&& r); -// -// Check that we ensure `size(r) == Extent`. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <span> -#include <vector> - -#include "check_assertion.h" - -int main(int, char**) { - std::vector<int> vec{ - 0, - 1, - 2}; // must use std::vector instead of std::array, because std::span has a special constructor from std::array - - auto invalid_size = [&] { - std::span<int, 2> const s(vec); - (void)s; - }; - TEST_LIBCPP_ASSERT_FAILURE(invalid_size(), "size mismatch in span's constructor (range)"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.back.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.back.pass.cpp deleted file mode 100644 index 7e656b7..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.back.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr reference back() const noexcept; - -// Make sure that accessing a span out-of-bounds triggers an assertion. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - std::span<int> const s(array.data(), 0); - TEST_LIBCPP_ASSERT_FAILURE(s.back(), "span<T>::back() on empty span"); - } - - { - std::array<int, 3> array{0, 1, 2}; - std::span<int, 0> const s(array.data(), 0); - TEST_LIBCPP_ASSERT_FAILURE(s.back(), "span<T, N>::back() on empty span"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.front.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.front.pass.cpp deleted file mode 100644 index 0068aad..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.front.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr reference front() const noexcept; - -// Make sure that accessing a span out-of-bounds triggers an assertion. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - std::span<int> const s(array.data(), 0); - TEST_LIBCPP_ASSERT_FAILURE(s.front(), "span<T>::front() on empty span"); - } - - { - std::array<int, 3> array{0, 1, 2}; - std::span<int, 0> const s(array.data(), 0); - TEST_LIBCPP_ASSERT_FAILURE(s.front(), "span<T, N>::front() on empty span"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.op_idx.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.op_idx.pass.cpp deleted file mode 100644 index 501067f..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.elem/assert.op_idx.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr reference operator[](size_type idx) const; - -// Make sure that accessing a span out-of-bounds triggers an assertion. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - std::span<int> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s[3], "span<T>::operator[](index): index out of range"); - } - - { - std::array<int, 3> array{0, 1, 2}; - std::span<int, 3> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s[3], "span<T, N>::operator[](index): index out of range"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.first.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.first.pass.cpp deleted file mode 100644 index f241f2a..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.first.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr span<element_type, dynamic_extent> first(size_type count) const; - -// Make sure that creating a sub-span with an incorrect number of elements triggers an assertion. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - std::span<int> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s.first(4), "span<T>::first(count): count out of range"); - TEST_LIBCPP_ASSERT_FAILURE(s.first<4>(), "span<T>::first<Count>(): Count out of range"); - } - { - std::array<int, 3> array{0, 1, 2}; - std::span<int, 3> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s.first(4), "span<T, N>::first(count): count out of range"); - // s.first<4>() caught at compile-time (tested elsewhere) - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.last.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.last.pass.cpp deleted file mode 100644 index 032df68..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.last.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// constexpr span<element_type, dynamic_extent> last(size_type count) const; - -// Make sure that creating a sub-span with an incorrect number of elements triggers an assertion. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - std::span<int> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s.last(4), "span<T>::last(count): count out of range"); - TEST_LIBCPP_ASSERT_FAILURE(s.last<4>(), "span<T>::last<Count>(): Count out of range"); - } - { - std::array<int, 3> array{0, 1, 2}; - std::span<int, 3> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s.last(4), "span<T, N>::last(count): count out of range"); - // s.last<4>() caught at compile-time (tested elsewhere) - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.subspan.pass.cpp b/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.subspan.pass.cpp deleted file mode 100644 index 5dd0fa0..0000000 --- a/libcxx/test/libcxx-03/containers/views/views.span/span.sub/assert.subspan.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <span> -// -// template<size_t Offset, size_t Count = dynamic_extent> -// constexpr span<element_type, see-below> subspan() const; -// -// Requires: Offset <= size() && (Count == dynamic_extent || Count <= size() - Offset) -// -// constexpr span<element_type, dynamic_extent> subspan( -// size_type offset, size_type count = dynamic_extent) const; -// -// Requires: offset <= size() && (count == dynamic_extent || count <= size() - offset) - -// Make sure that creating a sub-span with an incorrect number of elements triggers an assertion. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <array> -#include <span> -#include <cstddef> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::array<int, 3> array{0, 1, 2}; - std::span<int> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s.subspan(4), "span<T>::subspan(offset, count): offset out of range"); - TEST_LIBCPP_ASSERT_FAILURE(s.subspan<4>(), "span<T>::subspan<Offset, Count>(): Offset out of range"); - - TEST_LIBCPP_ASSERT_FAILURE(s.subspan(0, 4), "span<T>::subspan(offset, count): offset + count out of range"); - TEST_LIBCPP_ASSERT_FAILURE((s.subspan<0, 4>()), "span<T>::subspan<Offset, Count>(): Offset + Count out of range"); - - TEST_LIBCPP_ASSERT_FAILURE(s.subspan(1, 3), "span<T>::subspan(offset, count): offset + count out of range"); - TEST_LIBCPP_ASSERT_FAILURE((s.subspan<1, 3>()), "span<T>::subspan<Offset, Count>(): Offset + Count out of range"); - } - { - std::array<int, 3> array{0, 1, 2}; - std::span<int, 3> const s(array.data(), array.size()); - TEST_LIBCPP_ASSERT_FAILURE(s.subspan(4), "span<T, N>::subspan(offset, count): offset out of range"); - // s.subspan<4>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp) - - TEST_LIBCPP_ASSERT_FAILURE(s.subspan(0, 4), "span<T, N>::subspan(offset, count): offset + count out of range"); - // s.subspan<0, 4>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp) - - TEST_LIBCPP_ASSERT_FAILURE(s.subspan(1, 3), "span<T, N>::subspan(offset, count): offset + count out of range"); - // s.subspan<1, 3>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp) - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/debug/containers.multithread.pass.cpp b/libcxx/test/libcxx-03/debug/containers.multithread.pass.cpp deleted file mode 100644 index 974da65..0000000 --- a/libcxx/test/libcxx-03/debug/containers.multithread.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++11, c++14 -// UNSUPPORTED: no-threads - -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -// test multithreaded container debugging - -#include <cassert> -#include <cstddef> -#include <deque> -#include <list> -#include <thread> -#include <vector> - -template <typename Container> -Container makeContainer(int size) { - Container c; - typedef typename Container::value_type ValueType; - for (int i = 0; i < size; ++i) - c.insert(c.end(), ValueType(i)); - assert(c.size() == static_cast<std::size_t>(size)); - return c; -} - -template <typename Container> -void ThreadUseIter() { - const std::size_t maxRounds = 7; - struct TestRunner{ - void operator()() { - for (std::size_t count = 0; count < maxRounds; count++) { - const std::size_t containerCount = 11; - std::vector<Container> containers; - std::vector<typename Container::iterator> iterators; - for (std::size_t containerIndex = 0; containerIndex < containerCount; containerIndex++) { - containers.push_back(makeContainer<Container>(3)); - Container& c = containers.back(); - iterators.push_back(c.begin()); - iterators.push_back(c.end()); - } - } - } - }; - - TestRunner r; - const std::size_t threadCount = 4; - std::vector<std::thread> threads; - for (std::size_t count = 0; count < threadCount; count++) - threads.emplace_back(r); - r(); - for (std::size_t count = 0; count < threadCount; count++) - threads[count].join(); -} - -int main(int, char**) { - ThreadUseIter<std::vector<int> >(); - return 0; -} diff --git a/libcxx/test/libcxx-03/debug/containers/sequence_container_iterators.pass.cpp b/libcxx/test/libcxx-03/debug/containers/sequence_container_iterators.pass.cpp deleted file mode 100644 index c456ff1..0000000 --- a/libcxx/test/libcxx-03/debug/containers/sequence_container_iterators.pass.cpp +++ /dev/null @@ -1,333 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03, c++11, c++14 - -// test container debugging - -#include <forward_list> -#include <list> -#include <vector> -#include <deque> -#include "check_assertion.h" -#include "container_debug_tests.h" -#include "test_macros.h" - -using namespace IteratorDebugChecks; - -template <class Container, ContainerType CT> -struct SequenceContainerChecks : BasicContainerChecks<Container, CT> { - using Base = BasicContainerChecks<Container, CT>; - using value_type = typename Container::value_type; - using allocator_type = typename Container::allocator_type; - using iterator = typename Container::iterator; - using const_iterator = typename Container::const_iterator; - - using Base::makeContainer; - using Base::makeValueType; -public: - static void run() { - Base::run(); - SanityTest(); - FrontOnEmptyContainer(); - - if constexpr(CT != CT_ForwardList) { - AssignInvalidates(); - BackOnEmptyContainer(); - InsertIterValue(); - InsertIterSizeValue(); - InsertIterIterIter(); - EmplaceIterValue(); - EraseIterIter(); - } - else { - SpliceFirstElemAfter(); - } - if constexpr (CT == CT_Vector || CT == CT_Deque || CT == CT_List) { - PopBack(); - } - if constexpr (CT == CT_List || CT == CT_Deque) { - PopFront(); // FIXME: Run with forward list as well - } - if constexpr (CT == CT_List || CT == CT_ForwardList) { - RemoveFirstElem(); - } - if constexpr (CT == CT_List) { - SpliceFirstElem(); - SpliceSameContainer(); - } - } - -private: - static void SanityTest() { - // sanity test - Container C = {1, 1, 1, 1}; - ::DoNotOptimize(&C); - } - - static void RemoveFirstElem() { - // See llvm.org/PR35564 - // remove(<first-elem>) - { - Container C = makeContainer(1); - auto FirstVal = *(C.begin()); - C.remove(FirstVal); - assert(C.empty()); - } - { - Container C = {1, 1, 1, 1}; - auto FirstVal = *(C.begin()); - C.remove(FirstVal); - assert(C.empty()); - } - } - - static void SpliceFirstElem() { - // See llvm.org/PR35564 - // splice(<first-elem>) - { - Container C = makeContainer(1); - Container C2; - C2.splice(C2.end(), C, C.begin(), ++C.begin()); - } - { - Container C = makeContainer(1); - Container C2; - C2.splice(C2.end(), C, C.begin()); - } - } - - static void SpliceSameContainer() { - // splice(<same-container>) - Container C = {1, 1}; - C.splice(C.end(), C, C.begin()); - } - - static void SpliceFirstElemAfter() { - // See llvm.org/PR35564 - // splice(<first-elem>) - { - Container C = makeContainer(1); - Container C2; - C2.splice_after(C2.begin(), C, C.begin(), ++C.begin()); - } - { - Container C = makeContainer(1); - Container C2; - C2.splice_after(C2.begin(), C, C.begin()); - } - } - - static void AssignInvalidates() { - // assign(Size, Value) - Container C(allocator_type{}); - iterator it1, it2, it3; - auto reset = [&]() { - C = makeContainer(3); - it1 = C.begin(); - it2 = ++C.begin(); - it3 = C.end(); - }; - auto check = [&]() { - EXPECT_DEATH( C.erase(it1) ); - EXPECT_DEATH( C.erase(it2) ); - EXPECT_DEATH( C.erase(it3, C.end()) ); - }; - reset(); - C.assign(2, makeValueType(4)); - check(); - reset(); - // assign(Iter, Iter) - std::vector<value_type> V = { - makeValueType(1), - makeValueType(2), - makeValueType(3) - }; - C.assign(V.begin(), V.end()); - check(); - reset(); - // assign(initializer_list) - C.assign({makeValueType(1), makeValueType(2), makeValueType(3)}); - check(); - } - - static void BackOnEmptyContainer() { - // testing back on empty - Container C = makeContainer(1); - Container const& CC = C; - (void)C.back(); - (void)CC.back(); - C.clear(); - EXPECT_DEATH( C.back() ); - EXPECT_DEATH( CC.back() ); - } - - static void FrontOnEmptyContainer() { - // testing front on empty - Container C = makeContainer(1); - Container const& CC = C; - (void)C.front(); - (void)CC.front(); - C.clear(); - EXPECT_DEATH( C.front() ); - EXPECT_DEATH( CC.front() ); - } - - static void EraseIterIter() { - // testing erase iter iter invalidation - Container C1 = makeContainer(3); - iterator it1 = C1.begin(); - iterator it1_next = ++C1.begin(); - iterator it1_after_next = ++C1.begin(); - ++it1_after_next; - iterator it1_back = --C1.end(); - assert(it1_next != it1_back); - if (CT == CT_Vector) { - EXPECT_DEATH( C1.erase(it1_next, it1) ); // bad range - } - C1.erase(it1, it1_after_next); - EXPECT_DEATH( C1.erase(it1) ); - EXPECT_DEATH( C1.erase(it1_next) ); - if (CT == CT_List) { - C1.erase(it1_back); - } else { - EXPECT_DEATH( C1.erase(it1_back) ); - } - } - - static void PopBack() { - // testing pop_back() invalidation - Container C1 = makeContainer(2); - iterator it1 = C1.end(); - --it1; - C1.pop_back(); - EXPECT_DEATH( C1.erase(it1) ); - C1.erase(C1.begin()); - assert(C1.size() == 0); - EXPECT_DEATH( C1.pop_back() ); - } - - static void PopFront() { - // testing pop_front() invalidation - Container C1 = makeContainer(2); - iterator it1 = C1.begin(); - C1.pop_front(); - EXPECT_DEATH( C1.erase(it1) ); - C1.erase(C1.begin()); - assert(C1.size() == 0); - EXPECT_DEATH( C1.pop_front() ); - } - - static void InsertIterValue() { - // testing insert(iter, value) - Container C1 = makeContainer(2); - iterator it1 = C1.begin(); - iterator it1_next = it1; - ++it1_next; - Container C2 = C1; - const value_type value = makeValueType(3); - value_type rvalue = makeValueType(3); - EXPECT_DEATH( C2.insert(it1, value) ); // wrong container - EXPECT_DEATH( C2.insert(it1, std::move(rvalue)) ); // wrong container - C1.insert(it1_next, value); - if (CT == CT_List) { - C1.insert(it1_next, value); - C1.insert(it1, value); - C1.insert(it1_next, std::move(rvalue)); - C1.insert(it1, std::move(rvalue)); - } else { - EXPECT_DEATH( C1.insert(it1_next, value) ); // invalidated iterator - EXPECT_DEATH( C1.insert(it1, value) ); // invalidated iterator - EXPECT_DEATH( C1.insert(it1_next, std::move(rvalue)) ); // invalidated iterator - EXPECT_DEATH( C1.insert(it1, std::move(rvalue)) ); // invalidated iterator - } - } - - static void EmplaceIterValue() { - // testing emplace(iter, value) - Container C1 = makeContainer(2); - iterator it1 = C1.begin(); - iterator it1_next = it1; - ++it1_next; - Container C2 = C1; - const value_type value = makeValueType(3); - EXPECT_DEATH( C2.emplace(it1, value) ); // wrong container - EXPECT_DEATH( C2.emplace(it1, makeValueType(4)) ); // wrong container - C1.emplace(it1_next, value); - if (CT == CT_List) { - C1.emplace(it1_next, value); - C1.emplace(it1, value); - } else { - EXPECT_DEATH( C1.emplace(it1_next, value) ); // invalidated iterator - EXPECT_DEATH( C1.emplace(it1, value) ); // invalidated iterator - } - } - - static void InsertIterSizeValue() { - // testing insert(iter, size, value) - Container C1 = makeContainer(2); - iterator it1 = C1.begin(); - iterator it1_next = it1; - ++it1_next; - Container C2 = C1; - const value_type value = makeValueType(3); - EXPECT_DEATH( C2.insert(it1, 1, value) ); // wrong container - C1.insert(it1_next, 2, value); - if (CT == CT_List) { - C1.insert(it1_next, 3, value); - C1.insert(it1, 1, value); - } else { - EXPECT_DEATH( C1.insert(it1_next, 1, value) ); // invalidated iterator - EXPECT_DEATH( C1.insert(it1, 1, value) ); // invalidated iterator - } - } - - static void InsertIterIterIter() { - // testing insert(iter, iter, iter) - Container C1 = makeContainer(2); - iterator it1 = C1.begin(); - iterator it1_next = it1; - ++it1_next; - Container C2 = C1; - std::vector<value_type> V = { - makeValueType(1), - makeValueType(2), - makeValueType(3) - }; - EXPECT_DEATH( C2.insert(it1, V.begin(), V.end()) ); // wrong container - C1.insert(it1_next, V.begin(), V.end()); - if (CT == CT_List) { - C1.insert(it1_next, V.begin(), V.end()); - C1.insert(it1, V.begin(), V.end()); - } else { - EXPECT_DEATH( C1.insert(it1_next, V.begin(), V.end()) ); // invalidated iterator - EXPECT_DEATH( C1.insert(it1, V.begin(), V.end()) ); // invalidated iterator - } - } -}; - -int main(int, char**) -{ - using Alloc = test_allocator<int>; - { - SequenceContainerChecks<std::list<int, Alloc>, CT_List>::run(); - SequenceContainerChecks<std::vector<int, Alloc>, CT_Vector>::run(); - } - // FIXME these containers don't support iterator debugging - if ((false)) { - SequenceContainerChecks< - std::vector<bool, test_allocator<bool>>, CT_VectorBool>::run(); - SequenceContainerChecks< - std::forward_list<int, Alloc>, CT_ForwardList>::run(); - SequenceContainerChecks< - std::deque<int, Alloc>, CT_Deque>::run(); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/debug/containers/string.pass.cpp b/libcxx/test/libcxx-03/debug/containers/string.pass.cpp deleted file mode 100644 index d1508e9..0000000 --- a/libcxx/test/libcxx-03/debug/containers/string.pass.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03, c++11, c++14 - -// test container debugging - -#include <string> -#include <vector> - -#include "test_macros.h" -#include "check_assertion.h" -#include "container_debug_tests.h" - -using namespace IteratorDebugChecks; - -typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> StringType; - -template <class Container = StringType, ContainerType CT = CT_String> -struct StringContainerChecks : BasicContainerChecks<Container, CT> { - using Base = BasicContainerChecks<Container, CT_String>; - using value_type = typename Container::value_type; - using allocator_type = typename Container::allocator_type; - using iterator = typename Container::iterator; - using const_iterator = typename Container::const_iterator; - - using Base::makeContainer; - using Base::makeValueType; - -public: - static void run() { - Base::run_iterator_tests(); - Base::run_allocator_aware_tests(); - - for (int N : {3, 128}) { - FrontOnEmptyContainer(N); - BackOnEmptyContainer(N); - PopBack(N); - } - } - -private: - static void BackOnEmptyContainer(int N) { - // testing back on empty - Container C = makeContainer(N); - Container const& CC = C; - iterator it = --C.end(); - (void)C.back(); - (void)CC.back(); - C.pop_back(); - EXPECT_DEATH( C.erase(it) ); - C.clear(); - EXPECT_DEATH( C.back() ); - EXPECT_DEATH( CC.back() ); - } - - static void FrontOnEmptyContainer(int N) { - // testing front on empty - Container C = makeContainer(N); - Container const& CC = C; - (void)C.front(); - (void)CC.front(); - C.clear(); - EXPECT_DEATH( C.front() ); - EXPECT_DEATH( CC.front() ); - } - - static void PopBack(int N) { - // testing pop_back() invalidation - Container C1 = makeContainer(N); - iterator it1 = C1.end(); - --it1; - C1.pop_back(); - EXPECT_DEATH( C1.erase(it1) ); - C1.erase(C1.begin(), C1.end()); - assert(C1.size() == 0); - TEST_LIBCPP_ASSERT_FAILURE(C1.pop_back(), "string::pop_back(): string is already empty"); - } -}; - -int main(int, char**) -{ - StringContainerChecks<>::run(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/debug/containers/unord_containers.pass.cpp b/libcxx/test/libcxx-03/debug/containers/unord_containers.pass.cpp deleted file mode 100644 index b4e439d..0000000 --- a/libcxx/test/libcxx-03/debug/containers/unord_containers.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03, c++11, c++14 - -// test container debugging - -#include <unordered_map> -#include <unordered_set> -#include <utility> -#include <cassert> -#include "check_assertion.h" -#include "container_debug_tests.h" -#include "test_macros.h" - -using namespace IteratorDebugChecks; - -template <class Container, ContainerType CT> -struct UnorderedContainerChecks : BasicContainerChecks<Container, CT> { - using Base = BasicContainerChecks<Container, CT>; - using value_type = typename Container::value_type; - using iterator = typename Container::iterator; - using const_iterator = typename Container::const_iterator; - using traits = std::iterator_traits<iterator>; - using category = typename traits::iterator_category; - - using Base::makeContainer; -public: - static void run() { - Base::run(); - } -private: - -}; - -int main(int, char**) -{ - using SetAlloc = test_allocator<int>; - using MapAlloc = test_allocator<std::pair<const int, int>>; - { - UnorderedContainerChecks< - std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, MapAlloc>, - CT_UnorderedMap>::run(); - UnorderedContainerChecks< - std::unordered_set<int, std::hash<int>, std::equal_to<int>, SetAlloc>, - CT_UnorderedSet>::run(); - UnorderedContainerChecks< - std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, MapAlloc>, - CT_UnorderedMultiMap>::run(); - UnorderedContainerChecks< - std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, SetAlloc>, - CT_UnorderedMultiSet>::run(); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.verify.cpp b/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.verify.cpp deleted file mode 100644 index 3fe7ced..0000000 --- a/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> -// -// template <class X> -// class auto_ptr; -// -// class auto_ptr<void>; -// -// template <class X> -// class auto_ptr_ref; -// -// Deprecated in C++11 - -// UNSUPPORTED: c++03 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR - -#include <memory> -#include "test_macros.h" - -typedef std::auto_ptr<int> AP; // expected-warning {{'auto_ptr<int>' is deprecated}} -typedef std::auto_ptr<void> APV; // expected-warning {{'auto_ptr<void>' is deprecated}} -typedef std::auto_ptr_ref<int> APR; // expected-warning {{'auto_ptr_ref<int>' is deprecated}} diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.verify.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.verify.cpp deleted file mode 100644 index 21fd4d2..0000000 --- a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.verify.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// allocator: -// pointer address(reference x) const; -// const_pointer address(const_reference x) const; - -// In C++20, parts of std::allocator<T> have been removed. -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <memory> -#include <cassert> - -#include "test_macros.h" - -template <class T> -void test_address() { - T* tp = new T(); - const T* ctp = tp; - const std::allocator<T> a; - assert(a.address(*tp) == tp); // expected-error 2 {{no member}} - assert(a.address(*ctp) == tp); // expected-error 2 {{no member}} - delete tp; -} - -struct A { - void operator&() const {} -}; - -int main(int, char**) { - test_address<int>(); - test_address<A>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.verify.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.verify.cpp deleted file mode 100644 index 4098bdb..0000000 --- a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.verify.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// allocator: -// pointer address(reference x) const; -// const_pointer address(const_reference x) const; - -// Deprecated in C++17 - -// REQUIRES: c++17 - -#include <memory> - -void f() { - int x = 0; - std::allocator<int> a; - - (void)a.address(x); // expected-warning {{'address' is deprecated}} -} diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.verify.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.verify.cpp deleted file mode 100644 index bf02c75..0000000 --- a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <memory> - -// allocator: -// T* allocate(size_t n, const void* hint); - -// Removed in C++20. - -#include <memory> - -void f() { - std::allocator<int> a; - a.allocate(3, nullptr); // expected-error {{too many arguments to function call}} -} diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.verify.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.verify.cpp deleted file mode 100644 index 8629df3..0000000 --- a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// allocator: -// T* allocate(size_t n, const void* hint); - -// Deprecated in C++17 - -// REQUIRES: c++17 - -#include <memory> - -#include "test_macros.h" - -void f() { - std::allocator<int> a; - TEST_IGNORE_NODISCARD a.allocate(3, nullptr); // expected-warning {{'allocate' is deprecated}} -} diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.verify.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.verify.cpp deleted file mode 100644 index b39f9d9..0000000 --- a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.verify.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// allocator: -// template <class... Args> void construct(pointer p, Args&&... args); - -// Removed in C++20. - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <memory> -#include <cassert> - -int A_constructed = 0; - -struct A { - int data; - A() { ++A_constructed; } - - A(const A&) { ++A_constructed; } - - explicit A(int) { ++A_constructed; } - A(int, int*) { ++A_constructed; } - - ~A() { --A_constructed; } -}; - -int move_only_constructed = 0; - -class move_only { - move_only(const move_only&) = delete; - move_only& operator=(const move_only&) = delete; - -public: - move_only(move_only&&) { ++move_only_constructed; } - move_only& operator=(move_only&&) { return *this; } - - move_only() { ++move_only_constructed; } - ~move_only() { --move_only_constructed; } - -public: - int data; // unused other than to make sizeof(move_only) == sizeof(int). - // but public to suppress "-Wunused-private-field" -}; - -int main(int, char**) { - { - std::allocator<A> a; - A* ap = a.allocate(3); - a.construct(ap); // expected-error {{no member}} - a.destroy(ap); // expected-error {{no member}} - a.construct(ap, A()); // expected-error {{no member}} - a.destroy(ap); // expected-error {{no member}} - a.construct(ap, 5); // expected-error {{no member}} - a.destroy(ap); // expected-error {{no member}} - a.construct(ap, 5, (int*)0); // expected-error {{no member}} - a.destroy(ap); // expected-error {{no member}} - a.deallocate(ap, 3); - } - { - std::allocator<move_only> a; - move_only* ap = a.allocate(3); - a.construct(ap); // expected-error {{no member}} - a.destroy(ap); // expected-error {{no member}} - a.construct(ap, move_only()); // expected-error {{no member}} - a.destroy(ap); // expected-error {{no member}} - a.deallocate(ap, 3); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.verify.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.verify.cpp deleted file mode 100644 index 0e0f3c3..0000000 --- a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.verify.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// allocator: -// size_type max_size() const throw(); - -// In C++20, parts of std::allocator<T> have been removed. -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <memory> -#include <limits> -#include <cstddef> -#include <cassert> - -#include "test_macros.h" - -int new_called = 0; - -int main(int, char**) { - const std::allocator<int> a; - std::size_t M = a.max_size(); // expected-error {{no member}} - assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int))); - - return 0; -} diff --git a/libcxx/test/libcxx-03/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp b/libcxx/test/libcxx-03/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp deleted file mode 100644 index 422f405..0000000 --- a/libcxx/test/libcxx-03/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <functional> - -// UNSUPPORTED: c++03, c++11, c++14 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS - -#include <functional> -#include <map> -#include <memory> -#include <optional> -#include <utility> -#include "test_macros.h" - -void test_functional() -{ - { - using T = std::plus<int>; - T::result_type a; // expected-warning {{is deprecated}} - T::first_argument_type b; // expected-warning {{is deprecated}} - T::second_argument_type c; // expected-warning {{is deprecated}} - (void)a; - (void)b; - (void)c; - } - { - using T = std::less<int>; - T::result_type a; // expected-warning {{is deprecated}} - T::first_argument_type b; // expected-warning {{is deprecated}} - T::second_argument_type c; // expected-warning {{is deprecated}} - (void)a; - (void)b; - (void)c; - } - { - using T = std::logical_not<int>; - T::result_type a; // expected-warning {{is deprecated}} - T::argument_type b; // expected-warning {{is deprecated}} - (void)a; - (void)b; - } -} - -void test_owner_less() -{ - { - using T = std::owner_less<std::shared_ptr<int>>; - T::result_type a; // expected-warning {{is deprecated}} - T::first_argument_type b; // expected-warning {{is deprecated}} - T::second_argument_type c; // expected-warning {{is deprecated}} - (void)a; - (void)b; - (void)c; - } - { - using T = std::owner_less<std::weak_ptr<int>>; - T::result_type a; // expected-warning {{is deprecated}} - T::first_argument_type b; // expected-warning {{is deprecated}} - T::second_argument_type c; // expected-warning {{is deprecated}} - (void)a; - (void)b; - (void)c; - } -} - -void test_hash() -{ - { - using T = std::hash<int>; - T::result_type a; // expected-warning {{is deprecated}} - T::argument_type b; // expected-warning {{is deprecated}} - (void)a; - (void)b; - } - { - using T = std::hash<std::shared_ptr<int>>; - T::result_type a; // expected-warning {{is deprecated}} - T::argument_type b; // expected-warning {{is deprecated}} - (void)a; - (void)b; - } - { - using T = std::hash<std::unique_ptr<int>>; - T::result_type a; // expected-warning {{is deprecated}} - T::argument_type b; // expected-warning {{is deprecated}} - (void)a; - (void)b; - } - { - using T = std::hash<std::optional<int>>; - T::result_type a; // expected-warning {{is deprecated}} - T::argument_type b; // expected-warning {{is deprecated}} - (void)a; - (void)b; - } -} - -void test_map() -{ - { - using T = std::map<int, int>::value_compare; - T::result_type a; // expected-warning {{is deprecated}} - T::first_argument_type b; // expected-warning {{is deprecated}} - T::second_argument_type c; // expected-warning {{is deprecated}} - (void)a; - (void)b; - (void)c; - } - { - using T = std::multimap<int, int>::value_compare; - T::result_type a; // expected-warning {{is deprecated}} - T::first_argument_type b; // expected-warning {{is deprecated}} - T::second_argument_type c; // expected-warning {{is deprecated}} - (void)a; - (void)b; - (void)c; - } -} diff --git a/libcxx/test/libcxx-03/depr/depr.function.objects/adaptors.depr_in_cxx11.verify.cpp b/libcxx/test/libcxx-03/depr/depr.function.objects/adaptors.depr_in_cxx11.verify.cpp deleted file mode 100644 index 87d81d0..0000000 --- a/libcxx/test/libcxx-03/depr/depr.function.objects/adaptors.depr_in_cxx11.verify.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <functional> - -// UNSUPPORTED: c++03 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS - -#include <functional> -#include <cassert> - -int identity(int v) { return v; } -int sum(int a, int b) { return a + b; } - -struct Foo { - int const_zero() const { return 0; } - int const_identity(int v) const { return v; } - int zero() { return 0; } - int identity(int v) { return v; } -}; - -void f() { - typedef std::pointer_to_unary_function<int, int> PUF; // expected-warning {{'pointer_to_unary_function<int, int>' is deprecated}} - typedef std::pointer_to_binary_function<int, int, int> PBF; // expected-warning {{'pointer_to_binary_function<int, int, int>' is deprecated}} - std::ptr_fun<int, int>(identity); // expected-warning {{'ptr_fun<int, int>' is deprecated}} - std::ptr_fun<int, int, int>(sum); // expected-warning {{'ptr_fun<int, int, int>' is deprecated}} - - typedef std::mem_fun_t<int, Foo> MFT0; // expected-warning {{'mem_fun_t<int, Foo>' is deprecated}} - typedef std::mem_fun1_t<int, Foo, int> MFT1; // expected-warning {{'mem_fun1_t<int, Foo, int>' is deprecated}} - typedef std::const_mem_fun_t<int, Foo> CMFT0; // expected-warning {{'const_mem_fun_t<int, Foo>' is deprecated}} - typedef std::const_mem_fun1_t<int, Foo, int> CMFT1; // expected-warning {{'const_mem_fun1_t<int, Foo, int>' is deprecated}} - std::mem_fun<int, Foo>(&Foo::zero); // expected-warning {{'mem_fun<int, Foo>' is deprecated}} - std::mem_fun<int, Foo, int>(&Foo::identity); // expected-warning {{'mem_fun<int, Foo, int>' is deprecated}} - std::mem_fun<int, Foo>(&Foo::const_zero); // expected-warning {{'mem_fun<int, Foo>' is deprecated}} - std::mem_fun<int, Foo, int>(&Foo::const_identity); // expected-warning {{'mem_fun<int, Foo, int>' is deprecated}} - - typedef std::mem_fun_ref_t<int, Foo> MFR0; // expected-warning {{'mem_fun_ref_t<int, Foo>' is deprecated}} - typedef std::mem_fun1_ref_t<int, Foo, int> MFR1; // expected-warning {{'mem_fun1_ref_t<int, Foo, int>' is deprecated}} - typedef std::const_mem_fun_ref_t<int, Foo> CMFR0; // expected-warning {{'const_mem_fun_ref_t<int, Foo>' is deprecated}} - typedef std::const_mem_fun1_ref_t<int, Foo, int> CMFR1; // expected-warning {{'const_mem_fun1_ref_t<int, Foo, int>' is deprecated}} - std::mem_fun_ref<int, Foo>(&Foo::zero); // expected-warning {{'mem_fun_ref<int, Foo>' is deprecated}} - std::mem_fun_ref<int, Foo, int>(&Foo::identity); // expected-warning {{'mem_fun_ref<int, Foo, int>' is deprecated}} - std::mem_fun_ref<int, Foo>(&Foo::const_zero); // expected-warning {{'mem_fun_ref<int, Foo>' is deprecated}} - std::mem_fun_ref<int, Foo, int>(&Foo::const_identity); // expected-warning {{'mem_fun_ref<int, Foo, int>' is deprecated}} -} diff --git a/libcxx/test/libcxx-03/depr/depr.rel_ops/rel_ops.depr_in_cxx20.verify.cpp b/libcxx/test/libcxx-03/depr/depr.rel_ops/rel_ops.depr_in_cxx20.verify.cpp deleted file mode 100644 index 35457f6..0000000 --- a/libcxx/test/libcxx-03/depr/depr.rel_ops/rel_ops.depr_in_cxx20.verify.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <utility> - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <utility> -#include <cassert> - -struct A { - int data_ = 0; -}; - -inline bool operator==(const A& x, const A& y) { return x.data_ == y.data_; } - -inline bool operator<(const A& x, const A& y) { return x.data_ < y.data_; } - -void test() { - using namespace std::rel_ops; - A a1{1}; - A a2{2}; - (void)(a1 == a1); - (void)(a1 != a2); // note not deprecated message, due to compiler generated operator. - std::rel_ops::operator!=(a1, a2); // expected-warning {{is deprecated}} - (void)(a1 < a2); - (void)(a1 > a2); // expected-warning 2 {{is deprecated}} - (void)(a1 <= a2); // expected-warning 2 {{is deprecated}} - (void)(a1 >= a2); // expected-warning 2 {{is deprecated}} -} diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp deleted file mode 100644 index 299cb12..0000000 --- a/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected_disabled_cpp17.verify.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// test unexpected - -#include <exception> - -void f() {} - -int main(int, char**) { - using T = std::unexpected_handler; // expected-error {{no type named 'unexpected_handler' in namespace 'std'}} - std::unexpected(); // expected-error {{no member named 'unexpected' in namespace 'std'}} - std::get_unexpected(); // expected-error {{no member named 'get_unexpected' in namespace 'std'}} - std::set_unexpected(f); // expected-error {{no type named 'set_unexpected' in namespace 'std'}} - - return 0; -} diff --git a/libcxx/test/libcxx-03/diagnostics/algorithm.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/algorithm.nodiscard.verify.cpp deleted file mode 100644 index 14febc1..0000000 --- a/libcxx/test/libcxx-03/diagnostics/algorithm.nodiscard.verify.cpp +++ /dev/null @@ -1,396 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <algorithm> functions are marked [[nodiscard]] - -// clang-format off - -#include <algorithm> -#include <functional> -#include <iterator> - -#include "test_macros.h" - -struct P { - bool operator()(int) const { return false; } -}; - -void test() { - int arr[1] = { 1 }; - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::adjacent_find(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::adjacent_find(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::all_of(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::any_of(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::binary_search(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::binary_search(std::begin(arr), std::end(arr), 1, std::greater<int>()); - -#if TEST_STD_VER >= 17 - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::clamp(2, 1, 3); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::clamp(2, 1, 3, std::greater<int>()); -#endif - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::count_if(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::count(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::equal_range(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::equal_range(std::begin(arr), std::end(arr), 1, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::equal(std::begin(arr), std::end(arr), std::begin(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::equal(std::begin(arr), std::end(arr), std::begin(arr), - std::greater<int>()); - -#if TEST_STD_VER >= 14 - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater<int>()); -#endif - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find_if_not(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find_if(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::find(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_heap_until(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_heap_until(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_heap(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_heap(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_partitioned(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), - std::greater<int>()); - -#if TEST_STD_VER >= 14 - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr), std::greater<int>()); -#endif - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_sorted_until(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_sorted_until(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_sorted(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_sorted(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), - std::end(arr), std::greater<int>()); - -#if TEST_STD_VER >= 20 - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::lexicographical_compare_three_way(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::lexicographical_compare_three_way(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::compare_three_way()); -#endif - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::lower_bound(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::lower_bound(std::begin(arr), std::end(arr), 1, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::max_element(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::max_element(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::max(1, 2); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::max(1, 2, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::max({1, 2, 3}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::max({1, 2, 3}, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::min_element(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::min_element(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::min(1, 2); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::min(1, 2, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::min({1, 2, 3}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::min({1, 2, 3}, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::minmax_element(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::minmax_element(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::minmax(1, 2); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::minmax(1, 2, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::minmax({1, 2, 3}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::minmax({1, 2, 3}, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), - std::greater<int>()); - -#if TEST_STD_VER >= 14 - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater<int>()); -#endif - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::none_of(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::remove_if(std::begin(arr), std::end(arr), P()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::remove(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::search_n(std::begin(arr), std::end(arr), 1, 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::search_n(std::begin(arr), std::end(arr), 1, 1, std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), - std::greater<int>()); - -#if TEST_STD_VER >= 17 - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::search(std::begin(arr), std::end(arr), - std::default_searcher(std::begin(arr), std::end(arr))); -#endif - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::unique(std::begin(arr), std::end(arr)); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::unique(std::begin(arr), std::end(arr), std::greater<int>()); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::upper_bound(std::begin(arr), std::end(arr), 1); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::upper_bound(std::begin(arr), std::end(arr), 1, std::greater<int>()); - -#if TEST_STD_VER >= 20 - int range[1]; - int* iter = range; - auto pred = [](auto...) { return true; }; - std::ranges::adjacent_find(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::adjacent_find(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::all_of(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::all_of(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::any_of(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::any_of(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::binary_search(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::binary_search(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::clamp(1, 2, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::count_if(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::count_if(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::count(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::count(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::equal_range(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::equal_range(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::equal(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::equal(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_end(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_end(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_first_of(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_first_of(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_if_not(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_if_not(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_if(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_if(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::includes(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::includes(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_heap_until(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_heap_until(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_heap(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_heap(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_partitioned(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_partitioned(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_permutation(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_permutation(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_sorted_until(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_sorted_until(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_sorted(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::is_sorted(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::lexicographical_compare(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::lexicographical_compare(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::lower_bound(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::lower_bound(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::max_element(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::max_element(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::max(1, 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::max({1, 2, 3}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::max(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::minmax_element(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::minmax_element(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::minmax(1, 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::minmax({1, 2, 3}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::minmax(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::mismatch(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::mismatch(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::none_of(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::none_of(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::remove_if(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::remove_if(iter, iter, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::remove(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::remove(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::search_n(range, 1, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::search_n(iter, iter, 1, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::search(range, range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::search(iter, iter, iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::unique(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::unique(iter, iter); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::upper_bound(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::upper_bound(iter, iter, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif - -#if TEST_STD_VER >= 23 - std::ranges::contains(range, 1); - // expected-warning@-1{{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::contains(iter, iter, 1); - // expected-warning@-1{{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::contains_subrange(range, range); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::contains_subrange(iter, iter, iter, iter); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_last_if_not(iter, iter, pred); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_last_if_not(range, pred); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_last_if(iter, iter, pred); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_last_if(range, pred); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_last(iter, iter, 1); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::find_last(range, 1); - // expected-warning@-1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::fold_left(range, 0, std::plus()); - // expected-warning@-1{{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::fold_left(iter, iter, 0, std::plus()); - // expected-warning@-1{{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::fold_left_with_iter(range, 0, std::plus()); - // expected-warning@-1{{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::fold_left_with_iter(iter, iter, 0, std::plus()); - // expected-warning@-1{{ignoring return value of function declared with 'nodiscard' attribute}} -#endif -} diff --git a/libcxx/test/libcxx-03/diagnostics/array.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/array.nodiscard.verify.cpp deleted file mode 100644 index 25a2f80..0000000 --- a/libcxx/test/libcxx-03/diagnostics/array.nodiscard.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <array> functions are marked [[nodiscard]] - -#include <array> - -void array_test() { - std::array<int, 1> array; - array.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void empty_array_test() { - std::array<int, 0> array; - array.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/bit.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/bit.nodiscard.verify.cpp deleted file mode 100644 index b172d51..0000000 --- a/libcxx/test/libcxx-03/diagnostics/bit.nodiscard.verify.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// check that <bit> functions are marked [[nodiscard]] - -// clang-format off - -#include <bit> - -#include "test_macros.h" - -void func() { - std::bit_cast<unsigned int>(42); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::bit_ceil(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::bit_floor(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::bit_width(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#if TEST_STD_VER >= 23 - std::byteswap(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif - std::countl_zero(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::countl_one(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::countr_zero(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::countr_one(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::has_single_bit(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::popcount(0u); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/chrono.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/chrono.nodiscard.verify.cpp deleted file mode 100644 index 4e7380b..0000000 --- a/libcxx/test/libcxx-03/diagnostics/chrono.nodiscard.verify.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that format functions are marked [[nodiscard]] as a conforming extension - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -#include <chrono> - -#include "test_macros.h" - -// These types have "private" constructors. -void test(std::chrono::time_zone tz, std::chrono::time_zone_link link, std::chrono::leap_second leap) { - std::chrono::tzdb_list& list = std::chrono::get_tzdb_list(); - list.front(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - list.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - list.end(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - list.cbegin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - list.cend(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - { - const std::chrono::tzdb& t = list.front(); - t.locate_zone("name"); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - t.current_zone(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - } - - namespace crno = std::chrono; - crno::get_tzdb_list(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - crno::get_tzdb(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - crno::locate_zone("n"); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - crno::current_zone(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - crno::remote_version(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - { - std::chrono::sys_seconds s{}; - std::chrono::local_seconds l{}; - std::chrono::choose z = std::chrono::choose::earliest; - tz.name(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - tz.get_info(s); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - tz.get_info(l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - tz.to_sys(l); // not nodiscard - tz.to_sys(l, z); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - operator==(tz, tz); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - operator<=>(tz, tz); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - } - - { - link.name(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - link.target(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - operator==(link, link); - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - operator<=>(link, link); - } - - { - leap.date(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - leap.value(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - } - - { - using t = std::chrono::zoned_traits<const std::chrono::time_zone*>; - t::default_zone(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - t::locate_zone(""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - } - - { // [time.clock.utc] - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::utc_clock::now(); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::utc_clock::to_sys(std::chrono::utc_seconds{}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::utc_clock::from_sys(std::chrono::sys_seconds{}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::get_leap_second_info(std::chrono::utc_seconds{}); - } - - { - std::chrono::zoned_time<std::chrono::seconds> zt; - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - static_cast<std::chrono::sys_seconds>(zt); - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - static_cast<std::chrono::local_seconds>(zt); - - zt.get_time_zone(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - zt.get_local_time(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - zt.get_sys_time(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - zt.get_info(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - } - - { // [time.clock.tai] - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::tai_clock::now(); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::tai_clock::to_utc(std::chrono::tai_seconds{}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::tai_clock::from_utc(std::chrono::utc_seconds{}); - } - - { // [time.clock.gps] - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::gps_clock::now(); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::gps_clock::to_utc(std::chrono::gps_seconds{}); - - // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} - std::chrono::gps_clock::from_utc(std::chrono::utc_seconds{}); - } -} diff --git a/libcxx/test/libcxx-03/diagnostics/cmath.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/cmath.nodiscard.verify.cpp deleted file mode 100644 index 14d1935..0000000 --- a/libcxx/test/libcxx-03/diagnostics/cmath.nodiscard.verify.cpp +++ /dev/null @@ -1,167 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// We don't control the implementation of the math.h functions on windows -// UNSUPPORTED: windows - -// Check that functions from `<cmath>` that Clang marks with the `[[gnu::const]]` attribute are declared -// `[[nodiscard]]`. - -// clang-format off - -#include <cmath> -#include "test_macros.h" - -void test() { - // These tests rely on Clang's behaviour of adding `[[gnu::const]]` to the double overload of most of the functions - // below. - // Without that attribute being added implicitly, this test can't be checked consistently because its result depends - // on whether we're getting libc++'s own `std::foo(double)` or the underlying C library's `foo(double)`. -#ifdef TEST_COMPILER_CLANG - std::ceil(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::fabs(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::floor(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::cbrt(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::copysign(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::fmax(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::fmin(0., 0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::nearbyint(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::rint(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::round(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} - std::trunc(0.); // expected-warning-re {{ignoring return value of function declared with {{.*}} attribute}} -#endif - - std::signbit(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::signbit(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::signbit(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::signbit(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::signbit(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::fpclassify(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fpclassify(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fpclassify(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fpclassify(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fpclassify(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isfinite(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isfinite(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isfinite(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isfinite(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isfinite(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isinf(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isinf(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isinf(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isinf(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isinf(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isnan(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnan(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnan(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnan(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnan(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isnormal(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnormal(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnormal(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnormal(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isnormal(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isgreater(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreater(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreater(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreater(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreater(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isgreaterequal(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreaterequal(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreaterequal(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreaterequal(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isgreaterequal(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isless(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isless(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isless(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isless(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isless(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::islessequal(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessequal(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessequal(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessequal(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessequal(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::islessgreater(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessgreater(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessgreater(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessgreater(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::islessgreater(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::isunordered(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isunordered(0., 0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isunordered(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isunordered(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::isunordered(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::ceil(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ceil(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ceil(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ceil(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::fabs(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fabs(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fabs(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fabs(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::floor(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::floor(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::floor(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::floor(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::cbrt(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::cbrt(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::cbrt(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::cbrt(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::copysign(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::copysign(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::copysign(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::copysign(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::fmax(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fmax(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fmax(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fmax(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::fmin(0.f, 0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fmin(0.l, 0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fmin(0, 0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::fmin(0U, 0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::nearbyint(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::nearbyint(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::nearbyint(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::nearbyint(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::rint(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::rint(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::rint(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::rint(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::round(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::round(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::round(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::round(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::trunc(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::trunc(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::trunc(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::trunc(0U); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/cstddef.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/cstddef.nodiscard.verify.cpp deleted file mode 100644 index a588ffa..0000000 --- a/libcxx/test/libcxx-03/diagnostics/cstddef.nodiscard.verify.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// check that <cstddef> functions are marked [[nodiscard]] - -#include <cstddef> - -#include "test_macros.h" - -void test() { - std::byte b{42}; - std::to_integer<int>(b); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/cstdlib.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/cstdlib.nodiscard.verify.cpp deleted file mode 100644 index d3c809f..0000000 --- a/libcxx/test/libcxx-03/diagnostics/cstdlib.nodiscard.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// We don't control the implementation of the stdlib.h functions on windows -// UNSUPPORTED: windows - -// check that <cstdlib> functions are marked [[nodiscard]] - -#include <cmath> -#include "test_macros.h" - -void test() { - std::abs(0l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::abs(0ll); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::abs(0.f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::abs(0.); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::abs(0.l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/deque.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/deque.nodiscard.verify.cpp deleted file mode 100644 index e8dda09..0000000 --- a/libcxx/test/libcxx-03/diagnostics/deque.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <deque> functions are marked [[nodiscard]] - -#include <deque> - -void test() { - std::deque<int> deque; - deque.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/filesystem.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/filesystem.nodiscard.verify.cpp deleted file mode 100644 index 830d8e3..0000000 --- a/libcxx/test/libcxx-03/diagnostics/filesystem.nodiscard.verify.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: availability-filesystem-missing - -// check that <filesystem> functions are marked [[nodiscard]] - -#include <filesystem> - -void test() { - std::filesystem::path path; - path.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/flat_map.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/flat_map.nodiscard.verify.cpp deleted file mode 100644 index 79b943b7..0000000 --- a/libcxx/test/libcxx-03/diagnostics/flat_map.nodiscard.verify.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_map> - -// [[nodiscard]] bool empty() const noexcept; - -#include <flat_map> - -void f() { - std::flat_map<int, int> c; - c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/flat_multimap.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/flat_multimap.nodiscard.verify.cpp deleted file mode 100644 index 9b7b827..0000000 --- a/libcxx/test/libcxx-03/diagnostics/flat_multimap.nodiscard.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_map> - -// class flat_multimap - -// [[nodiscard]] bool empty() const noexcept; - -#include <flat_map> - -void f() { - std::flat_multimap<int, int> c; - c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/flat_multiset.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/flat_multiset.nodiscard.verify.cpp deleted file mode 100644 index a271a29..0000000 --- a/libcxx/test/libcxx-03/diagnostics/flat_multiset.nodiscard.verify.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// [[nodiscard]] bool empty() const noexcept; - -#include <flat_set> - -void f() { - std::flat_multiset<int> c; - c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/flat_set.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/flat_set.nodiscard.verify.cpp deleted file mode 100644 index 161fe53..0000000 --- a/libcxx/test/libcxx-03/diagnostics/flat_set.nodiscard.verify.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <flat_set> - -// [[nodiscard]] bool empty() const noexcept; - -#include <flat_set> - -void f() { - std::flat_set<int> c; - c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/format.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/format.nodiscard.verify.cpp deleted file mode 100644 index ede6988..0000000 --- a/libcxx/test/libcxx-03/diagnostics/format.nodiscard.verify.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that format functions are marked [[nodiscard]] as a conforming extension - -// TODO FMT This test should not require std::to_chars(floating-point) -// XFAIL: availability-fp_to_chars-missing - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <format> - -#include "test_macros.h" - -#ifndef TEST_HAS_NO_LOCALIZATION -# include <locale> -#endif - -void test() { - // clang-format off - std::format(""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::vformat("", std::make_format_args()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::formatted_size(""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::make_format_args(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::format(L""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::vformat(L"", std::make_wformat_args()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::formatted_size(L""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::make_wformat_args(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif // TEST_HAS_NO_WIDE_CHARACTERS - -#ifndef TEST_HAS_NO_LOCALIZATION - std::format(std::locale::classic(), ""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::vformat(std::locale::classic(), "", std::make_format_args()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::formatted_size(std::locale::classic(), ""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -# ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::format(std::locale::classic(), L""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::vformat(std::locale::classic(), L"", std::make_wformat_args()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::formatted_size(std::locale::classic(), L""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -# endif // TEST_HAS_NO_WIDE_CHARACTERS -#endif // TEST_HAS_NO_LOCALIZATION - // clang-format on -} diff --git a/libcxx/test/libcxx-03/diagnostics/forward_list.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/forward_list.nodiscard.verify.cpp deleted file mode 100644 index 7594a1d..0000000 --- a/libcxx/test/libcxx-03/diagnostics/forward_list.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <forward_list> functions are marked [[nodiscard]] - -#include <forward_list> - -void test() { - std::forward_list<int> forward_list; - forward_list.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/functional.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/functional.nodiscard.verify.cpp deleted file mode 100644 index 4307976..0000000 --- a/libcxx/test/libcxx-03/diagnostics/functional.nodiscard.verify.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// check that <functional> functions are marked [[nodiscard]] - -#include <functional> - -#include "test_macros.h" - -void test() { - int i = 0; - std::identity()(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/future.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/future.nodiscard.verify.cpp deleted file mode 100644 index cc5c613..0000000 --- a/libcxx/test/libcxx-03/diagnostics/future.nodiscard.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// UNSUPPORTED: no-threads - -// check that <future> functions are marked [[nodiscard]] - -// clang-format off - -#include <future> - -void test() { - std::async([]() {}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::async(std::launch::any, []() {}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/iterator.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/iterator.nodiscard.verify.cpp deleted file mode 100644 index c7cd2f5..0000000 --- a/libcxx/test/libcxx-03/diagnostics/iterator.nodiscard.verify.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// check that <iterator> functions are marked [[nodiscard]] - -// clang-format off - -#include <iterator> -#include <vector> - -#include "test_macros.h" - -void test() { - std::vector<int> container; - int c_array[] = {1, 2, 3}; - std::initializer_list<int> initializer_list; - - std::empty(container); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::empty(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::empty(initializer_list); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::prev(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::next(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#if TEST_STD_VER >= 20 - std::ranges::prev(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::prev(container.end(), 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::next(container.end(), 2, container.begin()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::next(c_array); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::next(container.begin(), 2); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::next(container.end(), 1, container.end()); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif -} diff --git a/libcxx/test/libcxx-03/diagnostics/limits.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/limits.nodiscard.verify.cpp deleted file mode 100644 index 7a81b84..0000000 --- a/libcxx/test/libcxx-03/diagnostics/limits.nodiscard.verify.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <limits> functions are marked [[nodiscard]] - -#include <limits> - -#include "test_macros.h" - -void func() { - // clang-format off - // arithmetic - std::numeric_limits<int>::min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::max(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::lowest(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::epsilon(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::round_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::infinity(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::quiet_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::signaling_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<int>::denorm_min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - // bool - std::numeric_limits<bool>::min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::max(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::lowest(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::epsilon(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::round_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::infinity(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::quiet_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::signaling_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<bool>::denorm_min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - // float - std::numeric_limits<float>::min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::max(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::lowest(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::epsilon(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::round_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::infinity(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::quiet_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::signaling_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<float>::denorm_min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - // double - std::numeric_limits<double>::min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::max(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::lowest(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::epsilon(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::round_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::infinity(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::quiet_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::signaling_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<double>::denorm_min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - // long double - std::numeric_limits<long double>::min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::max(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::lowest(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::epsilon(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::round_error(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::infinity(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::quiet_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::signaling_NaN(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::numeric_limits<long double>::denorm_min(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - // clang-format on -} diff --git a/libcxx/test/libcxx-03/diagnostics/list.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/list.nodiscard.verify.cpp deleted file mode 100644 index f19224a7..0000000 --- a/libcxx/test/libcxx-03/diagnostics/list.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <list> functions are marked [[nodiscard]] - -#include <list> - -void test() { - std::list<int> list; - list.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/map.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/map.nodiscard.verify.cpp deleted file mode 100644 index 78a8dd7..0000000 --- a/libcxx/test/libcxx-03/diagnostics/map.nodiscard.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <map> functions are marked [[nodiscard]] - -#include <map> - -void map_test() { - std::map<int, int> map; - map.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void multimap_test() { - std::multimap<int, int> multimap; - multimap.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/memory.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/memory.nodiscard.verify.cpp deleted file mode 100644 index 6410c84..0000000 --- a/libcxx/test/libcxx-03/diagnostics/memory.nodiscard.verify.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <memory> functions are marked [[nodiscard]] - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - -// clang-format off - -#include <memory> - -#include "test_macros.h" - -void test() { - std::get_temporary_buffer<int>(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void test_allocator_traits() { - std::allocator<int> allocator; - std::allocator_traits<std::allocator<int>> allocator_traits; - allocator_traits.allocate(allocator, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - allocator_traits.allocate(allocator, 1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void test_allocator() { - std::allocator<int> allocator; - allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#if TEST_STD_VER <= 17 - allocator.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif -#if TEST_STD_VER >= 23 - allocator.allocate_at_least(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif -} diff --git a/libcxx/test/libcxx-03/diagnostics/memory_resource.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/memory_resource.nodiscard.verify.cpp deleted file mode 100644 index 57c3823..0000000 --- a/libcxx/test/libcxx-03/diagnostics/memory_resource.nodiscard.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// check that <memory_resource> functions are marked [[nodiscard]] - -// clang-format off - -#include <memory_resource> - -#include "test_macros.h" - -void test() { - std::pmr::memory_resource* resource = std::pmr::null_memory_resource(); - resource->allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::pmr::polymorphic_allocator<int> polymorphic_allocator; - polymorphic_allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/mutex.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/mutex.nodiscard.verify.cpp deleted file mode 100644 index b9890ce..0000000 --- a/libcxx/test/libcxx-03/diagnostics/mutex.nodiscard.verify.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// UNSUPPORTED: no-threads - -// check that <mutex> functions are marked [[nodiscard]] - -#include <mutex> -#include <chrono> -#include <utility> - -#include "test_macros.h" - -void test() { - // std::scoped_lock - { -#if TEST_STD_VER >= 17 - using M = std::mutex; - M m0, m1, m2; - // clang-format off - std::scoped_lock<>{}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::scoped_lock<M>{m0}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::scoped_lock<M, M>{m0, m1}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::scoped_lock<M, M, M>{m0, m1, m2}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - - std::scoped_lock<>{std::adopt_lock}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::scoped_lock<M>{std::adopt_lock, m0}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::scoped_lock<M, M>{std::adopt_lock, m0, m1}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::scoped_lock<M, M, M>{std::adopt_lock, m0, m1, m2}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - // clang-format on -#endif - } - - // std::unique_lock - { - using M = std::timed_mutex; // necessary for the time_point and duration constructors - M m; - std::chrono::time_point<std::chrono::steady_clock> time_point; - std::chrono::milliseconds duration; - std::unique_lock<M> other; - - // clang-format off - std::unique_lock<M>{}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>{m}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>{m, std::defer_lock}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>{m, std::try_to_lock}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>{m, std::adopt_lock}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>{m, time_point}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>{m, duration}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::unique_lock<M>(std::move(other)); // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - // clang-format on - } - - // std::lock_guard - { - std::mutex m; - // clang-format off - std::lock_guard<std::mutex>{m}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - std::lock_guard<std::mutex>{m, std::adopt_lock}; // expected-warning {{ignoring temporary created by a constructor declared with 'nodiscard' attribute}} - // clang-format on - } -} diff --git a/libcxx/test/libcxx-03/diagnostics/new.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/new.nodiscard.verify.cpp deleted file mode 100644 index 505618c..0000000 --- a/libcxx/test/libcxx-03/diagnostics/new.nodiscard.verify.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <array> functions are marked [[nodiscard]] - -// clang-format off - -#include <new> - -#include "test_macros.h" - -void test() { - ::operator new(0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - ::operator new(0, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - ::operator new[](0); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - ::operator new[](0, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#if _LIBCPP_HAS_ALIGNED_ALLOCATION - ::operator new(0, std::align_val_t{1}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - ::operator new(0, std::align_val_t{1}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - ::operator new[](0, std::align_val_t{1}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - ::operator new[](0, std::align_val_t{1}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif // _LIBCPP_HAS_ALIGNED_ALLOCATION - -#if TEST_STD_VER >= 17 - int* ptr = nullptr; - std::launder(ptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif -} diff --git a/libcxx/test/libcxx-03/diagnostics/node_handle.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/node_handle.nodiscard.verify.cpp deleted file mode 100644 index 84aeafe..0000000 --- a/libcxx/test/libcxx-03/diagnostics/node_handle.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// check that <__node_handle> functions are marked [[nodiscard]] - -#include <set> - -void func() { - std::set<int> set; - set.extract(0).empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/pstl.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/pstl.nodiscard.verify.cpp deleted file mode 100644 index a16e071..0000000 --- a/libcxx/test/libcxx-03/diagnostics/pstl.nodiscard.verify.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that PSTL algorithms are marked [[nodiscard]] as a conforming extension - -// UNSUPPORTED: libcpp-has-no-incomplete-pstl - -// UNSUPPORTED: c++03, c++11, c++14 - -// clang-format off - -#include <algorithm> -#include <execution> -#include <iterator> - -void test() { - int a[] = {1}; - auto pred = [](auto) { return false; }; - std::all_of(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::any_of(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::none_of(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::is_partitioned(std::execution::par, std::begin(a), std::end(a), pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/queue.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/queue.nodiscard.verify.cpp deleted file mode 100644 index 77d3367..0000000 --- a/libcxx/test/libcxx-03/diagnostics/queue.nodiscard.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <queue> functions are marked [[nodiscard]] - -#include <queue> - -void test_queue() { - std::queue<int> queue; - queue.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void test_priority_queue() { - std::priority_queue<int> priority_queue; - priority_queue.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/ranges.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/ranges.nodiscard.verify.cpp deleted file mode 100644 index 03b4df7..0000000 --- a/libcxx/test/libcxx-03/diagnostics/ranges.nodiscard.verify.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that ranges are marked [[nodiscard]] as a conforming extension - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// clang-format off - -#include <ranges> -#include <functional> -#include <vector> - -#include "test_macros.h" - -void test() { - std::vector<int> range; - std::ranges::less_equal pred; - - std::views::drop(pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::views::split(range, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::split(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::views::take(range, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::take(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - -#if TEST_STD_VER >= 23 - std::views::drop(std::views::repeat(1)); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::views::repeat(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::repeat(1, std::unreachable_sentinel); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - auto rvalue_view = std::views::as_rvalue(range); - std::views::as_rvalue(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::as_rvalue(rvalue_view); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::views::chunk_by(pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::chunk_by(range, pred); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::views::take(std::views::repeat(3), 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::take(std::views::repeat(3, std::unreachable_sentinel), 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - std::allocator<int> alloc; - - std::ranges::to<std::vector<int>>(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::to<std::vector<int>>(range, alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::to<std::vector>(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::ranges::to<std::vector>(range, alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::ranges::to<std::vector<int>>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::ranges::to<std::vector<int>>(alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::ranges::to<std::vector>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::ranges::to<std::vector>(alloc); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif // TEST_STD_VER >= 23 -} diff --git a/libcxx/test/libcxx-03/diagnostics/regex.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/regex.nodiscard.verify.cpp deleted file mode 100644 index 0959ec5..0000000 --- a/libcxx/test/libcxx-03/diagnostics/regex.nodiscard.verify.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// UNSUPPORTED: no-localization - -// check that <regex> functions are marked [[nodiscard]] - -#include <regex> - -void test() { - std::cmatch match_result; - match_result.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/scoped_allocator.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/scoped_allocator.nodiscard.verify.cpp deleted file mode 100644 index 5c5360c..0000000 --- a/libcxx/test/libcxx-03/diagnostics/scoped_allocator.nodiscard.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <scoped_allocator> functions are marked [[nodiscard]] - -// clang-format off - -#include <memory> -#include <scoped_allocator> - -void test() { - std::scoped_allocator_adaptor<std::allocator<int>> alloc; - alloc.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - alloc.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/set.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/set.nodiscard.verify.cpp deleted file mode 100644 index cc6fb55..0000000 --- a/libcxx/test/libcxx-03/diagnostics/set.nodiscard.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <set> functions are marked [[nodiscard]] - -#include <set> - -void set_test() { - std::set<int> set; - set.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void multiset_test() { - std::multiset<int> multiset; - multiset.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/stack.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/stack.nodiscard.verify.cpp deleted file mode 100644 index 861852a..0000000 --- a/libcxx/test/libcxx-03/diagnostics/stack.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <stack> functions are marked [[nodiscard]] - -#include <stack> - -void test() { - std::stack<int> stack; - stack.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/string.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/string.nodiscard.verify.cpp deleted file mode 100644 index 746ae63..0000000 --- a/libcxx/test/libcxx-03/diagnostics/string.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <string> functions are marked [[nodiscard]] - -#include <string> - -void test() { - std::string string; - string.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/string_view.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/string_view.nodiscard.verify.cpp deleted file mode 100644 index b5548bc..0000000 --- a/libcxx/test/libcxx-03/diagnostics/string_view.nodiscard.verify.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <string_view> functions are marked [[nodiscard]] - -#include <string_view> - -void test() { - std::string_view string_view; - string_view.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/unordered_map.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/unordered_map.nodiscard.verify.cpp deleted file mode 100644 index a5d347e..0000000 --- a/libcxx/test/libcxx-03/diagnostics/unordered_map.nodiscard.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <unordered_map> functions are marked [[nodiscard]] - -// clang-format off - -#include <unordered_map> - -void unordered_map_test() { - std::unordered_map<int, int> unordered_map; - unordered_map.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void unordered_multimap_test() { - std::unordered_multimap<int, int> unordered_multimap; - unordered_multimap.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/unordered_set.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/unordered_set.nodiscard.verify.cpp deleted file mode 100644 index 5d35cf0..0000000 --- a/libcxx/test/libcxx-03/diagnostics/unordered_set.nodiscard.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <unordered_set> functions are marked [[nodiscard]] - -// clang-format off - -#include <unordered_set> - -void unordered_set_test() { - std::unordered_set<int> unordered_set; - unordered_set.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void unordered_multiset_test() { - std::unordered_multiset<int> unordered_multiset; - unordered_multiset.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/diagnostics/utility.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/utility.nodiscard.verify.cpp deleted file mode 100644 index 524be96..0000000 --- a/libcxx/test/libcxx-03/diagnostics/utility.nodiscard.verify.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <utility> functions are marked [[nodiscard]] - -// clang-format off - -#include <utility> - -#include "test_macros.h" - -void test() { - int i = 0; - - std::forward<int>(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::forward<int>(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::move(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::move_if_noexcept(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - -#if TEST_STD_VER >= 17 - std::as_const(i); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif - -#if TEST_STD_VER >= 23 - enum E { Apple, Orange } e = Apple; - std::to_underlying(e); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -#endif -} diff --git a/libcxx/test/libcxx-03/diagnostics/vector.nodiscard.verify.cpp b/libcxx/test/libcxx-03/diagnostics/vector.nodiscard.verify.cpp deleted file mode 100644 index 51e90af..0000000 --- a/libcxx/test/libcxx-03/diagnostics/vector.nodiscard.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// check that <vector> functions are marked [[nodiscard]] - -#include <vector> - -void test_vector() { - std::vector<int> vector; - vector.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} - -void test_vector_bool() { - std::vector<bool> vector; - vector.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/fuzzing/format_no_args.pass.cpp b/libcxx/test/libcxx-03/fuzzing/format_no_args.pass.cpp deleted file mode 100644 index 2faf27e..0000000 --- a/libcxx/test/libcxx-03/fuzzing/format_no_args.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-exceptions - -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// XFAIL: availability-fp_to_chars-missing - -#include <cstdint> -#include <format> -#include <string_view> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, std::size_t size) { - try { - [[maybe_unused]] auto result = std::vformat(std::string_view{(const char*)(data), size}, std::make_format_args()); - } catch (std::format_error const&) { - // If the fuzzing input isn't a valid thing we can format and we detect it, it's okay. We are looking for crashes. - return 0; - } - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/fuzz.h b/libcxx/test/libcxx-03/fuzzing/fuzz.h deleted file mode 100644 index 5e70d0a..0000000 --- a/libcxx/test/libcxx-03/fuzzing/fuzz.h +++ /dev/null @@ -1,145 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_FUZZING_FUZZ_H -#define TEST_LIBCXX_FUZZING_FUZZ_H - -#include <cassert> -#include <cstddef> -#include <cstdint> -#include <cstring> // std::strlen -#include <iterator> -#include <type_traits> -#include <utility> // std::swap - - -// This is a struct we can use to test the stable_XXX algorithms. -// Perform the operation on the key, then check the order of the payload. -struct ByteWithPayload { - std::uint8_t key; - std::size_t payload; - - ByteWithPayload(std::uint8_t k) : key(k), payload(0) { } - ByteWithPayload(std::uint8_t k, std::size_t p) : key(k), payload(p) { } - - friend bool operator==(ByteWithPayload const& x, ByteWithPayload const& y) { - return x.key == y.key && x.payload == y.payload; - } - - friend bool operator!=(ByteWithPayload const& x, ByteWithPayload const& y) { - return !(x == y); - } - - struct key_less { - bool operator()(ByteWithPayload const& x, ByteWithPayload const& y) const - { return x.key < y.key; } - }; - - struct payload_less { - bool operator()(ByteWithPayload const& x, ByteWithPayload const& y) const - { return x.payload < y.payload; } - }; - - struct total_less { - bool operator()(ByteWithPayload const& x, ByteWithPayload const& y) const { - return x.key == y.key ? x.payload < y.payload : x.key < y.key; - } - }; - - friend void swap(ByteWithPayload& lhs, ByteWithPayload& rhs) { - std::swap(lhs.key, rhs.key); - std::swap(lhs.payload, rhs.payload); - } -}; - -// Faster version of std::is_permutation -// -// Builds a set of buckets for each of the key values, and sums all the payloads. -// Not 100% perfect, but _way_ faster. -template <typename Iter1, typename Iter2, typename = typename std::enable_if< - std::is_same<typename std::iterator_traits<Iter1>::value_type, ByteWithPayload>::value && - std::is_same<typename std::iterator_traits<Iter2>::value_type, ByteWithPayload>::value ->::type> -bool fast_is_permutation(Iter1 first1, Iter1 last1, Iter2 first2) { - std::size_t xBuckets[256] = {0}; - std::size_t xPayloads[256] = {0}; - std::size_t yBuckets[256] = {0}; - std::size_t yPayloads[256] = {0}; - - for (; first1 != last1; ++first1, ++first2) { - xBuckets[first1->key]++; - xPayloads[first1->key] += first1->payload; - - yBuckets[first2->key]++; - yPayloads[first2->key] += first2->payload; - } - - for (std::size_t i = 0; i < 256; ++i) { - if (xBuckets[i] != yBuckets[i]) - return false; - if (xPayloads[i] != yPayloads[i]) - return false; - } - - return true; -} - -template <typename Iter1, typename Iter2, typename = void, typename = typename std::enable_if< - std::is_same<typename std::iterator_traits<Iter1>::value_type, std::uint8_t>::value && - std::is_same<typename std::iterator_traits<Iter2>::value_type, std::uint8_t>::value ->::type> -bool fast_is_permutation(Iter1 first1, Iter1 last1, Iter2 first2) { - std::size_t xBuckets[256] = {0}; - std::size_t yBuckets[256] = {0}; - - for (; first1 != last1; ++first1, ++first2) { - xBuckets[*first1]++; - yBuckets[*first2]++; - } - - for (std::size_t i = 0; i < 256; ++i) - if (xBuckets[i] != yBuckets[i]) - return false; - - return true; -} - -// When running inside OSS-Fuzz, we link against a fuzzing library that defines -// main() and calls LLVMFuzzerTestOneInput. -// -// Otherwise, when e.g. running the Lit tests, we define main() to run fuzzing -// tests on a few inputs. -#if !defined(LIBCPP_OSS_FUZZ) -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t*, std::size_t); - -int main(int, char**) { - const char* test_cases[] = { - "", - "s", - "bac", - "bacasf", - "lkajseravea", - "adsfkajdsfjkas;lnc441324513,34535r34525234", - "b*c", - "ba?sf", - "lka*ea", - "adsf*kas;lnc441[0-9]1r34525234" - }; - - for (const char* tc : test_cases) { - const std::size_t size = std::strlen(tc); - const std::uint8_t* data = reinterpret_cast<const std::uint8_t*>(tc); - int result = LLVMFuzzerTestOneInput(data, size); - assert(result == 0); - } - - return 0; -} -#endif // !LIBCPP_OSS_FUZZ - -#endif // TEST_LIBCXX_FUZZING_FUZZ_H diff --git a/libcxx/test/libcxx-03/fuzzing/make_heap.pass.cpp b/libcxx/test/libcxx-03/fuzzing/make_heap.pass.cpp deleted file mode 100644 index ede82c2..0000000 --- a/libcxx/test/libcxx-03/fuzzing/make_heap.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - std::vector<std::uint8_t> working(data, data + size); - std::make_heap(working.begin(), working.end()); - - if (!std::is_heap(working.begin(), working.end())) - return 1; - if (!fast_is_permutation(data, data + size, working.cbegin())) - return 99; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/nth_element.pass.cpp b/libcxx/test/libcxx-03/fuzzing/nth_element.pass.cpp deleted file mode 100644 index 45f4aed..0000000 --- a/libcxx/test/libcxx-03/fuzzing/nth_element.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -// Use the first element as a position into the data -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - if (size <= 1) return 0; - const std::size_t partition_point = data[0] % size; - std::vector<std::uint8_t> working(data + 1, data + size); - const auto partition_iter = working.begin() + partition_point; - std::nth_element(working.begin(), partition_iter, working.end()); - - // nth may be the end iterator, in this case nth_element has no effect. - if (partition_iter == working.end()) { - if (!std::equal(data + 1, data + size, working.begin())) - return 98; - } - else { - const std::uint8_t nth = *partition_iter; - if (!std::all_of(working.begin(), partition_iter, [=](std::uint8_t v) { return v <= nth; })) - return 1; - if (!std::all_of(partition_iter, working.end(), [=](std::uint8_t v) { return v >= nth; })) - return 2; - if (!fast_is_permutation(data + 1, data + size, working.cbegin())) - return 99; - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/partial_sort.pass.cpp b/libcxx/test/libcxx-03/fuzzing/partial_sort.pass.cpp deleted file mode 100644 index c179846..0000000 --- a/libcxx/test/libcxx-03/fuzzing/partial_sort.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -// Use the first element as a position into the data -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - if (size <= 1) - return 0; - const std::size_t sort_point = data[0] % size; - std::vector<std::uint8_t> working(data + 1, data + size); - const auto sort_iter = working.begin() + sort_point; - std::partial_sort(working.begin(), sort_iter, working.end()); - - if (sort_iter != working.end()) { - const std::uint8_t nth = *std::min_element(sort_iter, working.end()); - if (!std::all_of(working.begin(), sort_iter, [=](std::uint8_t v) { return v <= nth; })) - return 1; - if (!std::all_of(sort_iter, working.end(), [=](std::uint8_t v) { return v >= nth; })) - return 2; - } - if (!std::is_sorted(working.begin(), sort_iter)) - return 3; - if (!fast_is_permutation(data + 1, data + size, working.cbegin())) - return 99; - - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/partial_sort_copy.pass.cpp b/libcxx/test/libcxx-03/fuzzing/partial_sort_copy.pass.cpp deleted file mode 100644 index 530ab0d..0000000 --- a/libcxx/test/libcxx-03/fuzzing/partial_sort_copy.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -// Use the first element as a count -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - if (size <= 1) - return 0; - const std::size_t num_results = data[0] % size; - std::vector<std::uint8_t> results(num_results); - (void)std::partial_sort_copy(data + 1, data + size, results.begin(), results.end()); - - // The results have to be sorted - if (!std::is_sorted(results.begin(), results.end())) - return 1; - // All the values in results have to be in the original data - for (auto v: results) - if (std::find(data + 1, data + size, v) == data + size) - return 2; - - // The things in results have to be the smallest N in the original data - std::vector<std::uint8_t> sorted(data + 1, data + size); - std::sort(sorted.begin(), sorted.end()); - if (!std::equal(results.begin(), results.end(), sorted.begin())) - return 3; - - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/partition.pass.cpp b/libcxx/test/libcxx-03/fuzzing/partition.pass.cpp deleted file mode 100644 index 203e45b..0000000 --- a/libcxx/test/libcxx-03/fuzzing/partition.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - auto is_even = [](auto x) { return x % 2 == 0; }; - std::vector<std::uint8_t> working(data, data + size); - auto iter = std::partition(working.begin(), working.end(), is_even); - - if (!std::all_of(working.begin(), iter, is_even)) - return 1; - if (!std::none_of(iter, working.end(), is_even)) - return 2; - if (!fast_is_permutation(data, data + size, working.cbegin())) - return 99; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/partition_copy.pass.cpp b/libcxx/test/libcxx-03/fuzzing/partition_copy.pass.cpp deleted file mode 100644 index ac37c2e..0000000 --- a/libcxx/test/libcxx-03/fuzzing/partition_copy.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <iterator> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - auto is_even = [](auto t) { - return t % 2 == 0; - }; - - std::vector<std::uint8_t> v1, v2; - auto iter = std::partition_copy(data, data + size, - std::back_inserter<std::vector<std::uint8_t>>(v1), - std::back_inserter<std::vector<std::uint8_t>>(v2), - is_even); - ((void)iter); - // The two vectors should add up to the original size - if (v1.size() + v2.size() != size) - return 1; - - // All of the even values should be in the first vector, and none in the second - if (!std::all_of(v1.begin(), v1.end(), is_even)) - return 2; - if (!std::none_of(v2.begin(), v2.end(), is_even)) - return 3; - - // Every value in both vectors has to be in the original - - // Make a copy of the input, and sort it - std::vector<std::uint8_t> v0{data, data + size}; - std::sort(v0.begin(), v0.end()); - - // Sort each vector and ensure that all of the elements appear in the original input - std::sort(v1.begin(), v1.end()); - if (!std::includes(v0.begin(), v0.end(), v1.begin(), v1.end())) - return 4; - - std::sort(v2.begin(), v2.end()); - if (!std::includes(v0.begin(), v0.end(), v2.begin(), v2.end())) - return 5; - - // This, while simple, is really slow - 20 seconds on a 500K element input. - // for (auto v: v1) - // if (std::find(data, data + size, v) == data + size) - // return 4; - // - // for (auto v: v2) - // if (std::find(data, data + size, v) == data + size) - // return 5; - - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/pop_heap.pass.cpp b/libcxx/test/libcxx-03/fuzzing/pop_heap.pass.cpp deleted file mode 100644 index e54eede..0000000 --- a/libcxx/test/libcxx-03/fuzzing/pop_heap.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - if (size < 2) - return 0; - std::vector<std::uint8_t> working(data, data + size); - std::make_heap(working.begin(), working.end()); - - // Pop things off, one at a time - auto iter = --working.end(); - while (iter != working.begin()) { - std::pop_heap(working.begin(), iter); - if (!std::is_heap(working.begin(), --iter)) - return 2; - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/push_heap.pass.cpp b/libcxx/test/libcxx-03/fuzzing/push_heap.pass.cpp deleted file mode 100644 index ce67176..0000000 --- a/libcxx/test/libcxx-03/fuzzing/push_heap.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - if (size < 2) - return 0; - - // Make a heap from the first half of the data - std::vector<std::uint8_t> working(data, data + size); - auto iter = working.begin() + (size / 2); - std::make_heap(working.begin(), iter); - if (!std::is_heap(working.begin(), iter)) - return 1; - - // Now push the rest onto the heap, one at a time - ++iter; - for (; iter != working.end(); ++iter) { - std::push_heap(working.begin(), iter); - if (!std::is_heap(working.begin(), iter)) - return 2; - } - - if (!fast_is_permutation(data, data + size, working.cbegin())) - return 99; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/random.pass.cpp b/libcxx/test/libcxx-03/fuzzing/random.pass.cpp deleted file mode 100644 index cb074bd..0000000 --- a/libcxx/test/libcxx-03/fuzzing/random.pass.cpp +++ /dev/null @@ -1,198 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 fails because Clang no longer enables -fdelayed-template-parsing -// by default on Windows with C++20 (#69431). -// XFAIL: msvc && (clang-18 || clang-19 || clang-20 || clang-21) - -// UNSUPPORTED: c++03, c++11 - -#include <cassert> -#include <cmath> -#include <cstddef> -#include <cstdint> -#include <cstring> -#include <random> -#include <type_traits> -#include <vector> - -#include "fuzz.h" - -template <class IntT> -std::vector<IntT> GetValues(const std::uint8_t *data, std::size_t size) { - std::vector<IntT> result; - while (size >= sizeof(IntT)) { - IntT tmp; - std::memcpy(&tmp, data, sizeof(IntT)); - size -= sizeof(IntT); - data += sizeof(IntT); - result.push_back(tmp); - } - return result; -} - -template <class Dist> -struct ParamTypeHelper { - using ParamT = typename Dist::param_type; - using ResultT = typename Dist::result_type; - static_assert(std::is_same<ResultT, typename ParamT::distribution_type::result_type>::value, ""); - - static ParamT Create(const std::uint8_t* data, std::size_t size, bool &OK) { - constexpr bool select_vector_result = std::is_constructible<ParamT, ResultT*, ResultT*, ResultT*>::value; - constexpr bool select_vector_double = std::is_constructible<ParamT, double*, double*>::value; - constexpr int selector = select_vector_result ? 0 : (select_vector_double ? 1 : 2); - return DispatchAndCreate(std::integral_constant<int, selector>{}, data, size, OK); - } - - // Vector result - static ParamT DispatchAndCreate(std::integral_constant<int, 0>, const std::uint8_t *data, std::size_t size, bool &OK) { - auto Input = GetValues<ResultT>(data, size); - OK = false; - if (Input.size() < 10) - return ParamT{}; - OK = true; - auto Beg = Input.begin(); - auto End = Input.end(); - auto Mid = Beg + ((End - Beg) / 2); - - assert(Mid - Beg <= (End - Mid)); - ParamT p(Beg, Mid, Mid); - return p; - } - - // Vector double - static ParamT DispatchAndCreate(std::integral_constant<int, 1>, const std::uint8_t *data, std::size_t size, bool &OK) { - auto Input = GetValues<double>(data, size); - - OK = true; - auto Beg = Input.begin(); - auto End = Input.end(); - - ParamT p(Beg, End); - return p; - } - - // Default - static ParamT DispatchAndCreate(std::integral_constant<int, 2>, const std::uint8_t *data, std::size_t size, bool &OK) { - OK = false; - if (size < sizeof(ParamT)) - return ParamT{}; - OK = true; - ParamT input; - std::memcpy(&input, data, sizeof(ParamT)); - return input; - } -}; - -template <class IntT> -struct ParamTypeHelper<std::poisson_distribution<IntT>> { - using Dist = std::poisson_distribution<IntT>; - using ParamT = typename Dist::param_type; - using ResultT = typename Dist::result_type; - - static ParamT Create(const std::uint8_t *data, std::size_t size, bool& OK) { - OK = false; - auto vals = GetValues<double>(data, size); - if (vals.empty() || std::isnan(vals[0]) || std::isnan(std::abs(vals[0])) || vals[0] < 0) - return ParamT{}; - OK = true; - return ParamT{vals[0]}; - } -}; - -template <class IntT> -struct ParamTypeHelper<std::geometric_distribution<IntT>> { - using Dist = std::geometric_distribution<IntT>; - using ParamT = typename Dist::param_type; - using ResultT = typename Dist::result_type; - - static ParamT Create(const std::uint8_t *data, std::size_t size, bool& OK) { - OK = false; - auto vals = GetValues<double>(data, size); - if (vals.empty() || std::isnan(vals[0]) || vals[0] < 0 ) - return ParamT{}; - OK = true; - return ParamT{vals[0]}; - } -}; - -template <class IntT> -struct ParamTypeHelper<std::lognormal_distribution<IntT>> { - using Dist = std::lognormal_distribution<IntT>; - using ParamT = typename Dist::param_type; - using ResultT = typename Dist::result_type; - - static ParamT Create(const std::uint8_t *data, std::size_t size, bool& OK) { - OK = false; - auto vals = GetValues<ResultT>(data, size); - if (vals.size() < 2 ) - return ParamT{}; - OK = true; - return ParamT{vals[0], vals[1]}; - } -}; - -template <> -struct ParamTypeHelper<std::bernoulli_distribution> { - using Dist = std::bernoulli_distribution; - using ParamT = Dist::param_type; - using ResultT = Dist::result_type; - - static ParamT Create(const std::uint8_t *data, std::size_t size, bool& OK) { - OK = false; - auto vals = GetValues<double>(data, size); - if (vals.empty()) - return ParamT{}; - OK = true; - return ParamT{vals[0]}; - } -}; - -template <class Distribution> -int helper(const std::uint8_t *data, std::size_t size) { - std::mt19937 engine; - using ParamT = typename Distribution::param_type; - bool OK; - ParamT p = ParamTypeHelper<Distribution>::Create(data, size, OK); - if (!OK) - return 0; - Distribution d(p); - volatile auto res = d(engine); - if (std::isnan(res)) { - // FIXME(llvm.org/PR44289): - // Investigate why these distributions are returning NaN and decide - // if that's what we want them to be doing. - // - // Make this assert false (or return non-zero). - return 0; - } - return 0; -} - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - return helper<std::uniform_int_distribution<std::int16_t>>(data, size) || - helper<std::uniform_real_distribution<float>>(data, size) || - helper<std::bernoulli_distribution>(data, size) || - helper<std::poisson_distribution<std::int16_t>>(data, size) || - helper<std::geometric_distribution<std::int16_t>>(data, size) || - helper<std::binomial_distribution<std::int16_t>>(data, size) || - helper<std::negative_binomial_distribution<std::int16_t>>(data, size) || - helper<std::exponential_distribution<float>>(data, size) || - helper<std::gamma_distribution<float>>(data, size) || - helper<std::weibull_distribution<float>>(data, size) || - helper<std::extreme_value_distribution<float>>(data, size) || - helper<std::normal_distribution<float>>(data, size) || - helper<std::lognormal_distribution<float>>(data, size) || - helper<std::chi_squared_distribution<float>>(data, size) || - helper<std::cauchy_distribution<float>>(data, size) || - helper<std::fisher_f_distribution<float>>(data, size) || - helper<std::student_t_distribution<float>>(data, size) || - helper<std::discrete_distribution<std::int16_t>>(data, size) || - helper<std::piecewise_constant_distribution<float>>(data, size) || - helper<std::piecewise_linear_distribution<float>>(data, size); -} diff --git a/libcxx/test/libcxx-03/fuzzing/regex.pass.cpp b/libcxx/test/libcxx-03/fuzzing/regex.pass.cpp deleted file mode 100644 index 7e3b362..0000000 --- a/libcxx/test/libcxx-03/fuzzing/regex.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// UNSUPPORTED: no-exceptions -// UNSUPPORTED: no-localization - -#include <cstddef> -#include <cstdint> -#include <regex> -#include <string> - -#include "fuzz.h" - -template <std::regex_constants::syntax_option_type Syntax> -static int regex_test(const std::uint8_t *data, std::size_t size) { - if (size == 0) - return 0; - - std::string s((const char *)data, size); - std::regex re; - try { - re.assign(s, Syntax); - } catch (std::regex_error &) { - // the data represents an invalid regex, ignore this test case - return 0; - } - - auto match = std::regex_match(s, re); - (void)match; - return 0; // always pretend we succeeded -- we're only looking for crashes -} - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - return regex_test<std::regex_constants::awk>(data, size) || - regex_test<std::regex_constants::basic>(data, size) || - regex_test<std::regex_constants::ECMAScript>(data, size) || - regex_test<std::regex_constants::egrep>(data, size) || - regex_test<std::regex_constants::extended>(data, size) || - regex_test<std::regex_constants::grep>(data, size); -} diff --git a/libcxx/test/libcxx-03/fuzzing/search.pass.cpp b/libcxx/test/libcxx-03/fuzzing/search.pass.cpp deleted file mode 100644 index e20fad2..0000000 --- a/libcxx/test/libcxx-03/fuzzing/search.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <cstdint> -#include <limits> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - if (size < 2) - return 0; - - const std::size_t pat_size = data[0] * (size - 1) / std::numeric_limits<uint8_t>::max(); - assert(pat_size <= size - 1); - const std::uint8_t *pat_begin = data + 1; - const std::uint8_t *pat_end = pat_begin + pat_size; - const std::uint8_t *data_end = data + size; - assert(pat_end <= data_end); - - auto it = std::search(pat_end, data_end, pat_begin, pat_end); - if (it != data_end) // not found - if (!std::equal(pat_begin, pat_end, it)) - return 1; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/sort.pass.cpp b/libcxx/test/libcxx-03/fuzzing/sort.pass.cpp deleted file mode 100644 index e118897..0000000 --- a/libcxx/test/libcxx-03/fuzzing/sort.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - std::vector<std::uint8_t> working(data, data + size); - std::sort(working.begin(), working.end()); - - if (!std::is_sorted(working.begin(), working.end())) - return 1; - if (!fast_is_permutation(data, data + size, working.cbegin())) - return 99; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/stable_partition.pass.cpp b/libcxx/test/libcxx-03/fuzzing/stable_partition.pass.cpp deleted file mode 100644 index 2a1799dc3..0000000 --- a/libcxx/test/libcxx-03/fuzzing/stable_partition.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - auto is_even = [](auto b) { return b.key % 2 == 0; }; - - std::vector<ByteWithPayload> input; - for (std::size_t i = 0; i < size; ++i) - input.push_back(ByteWithPayload(data[i], i)); - std::vector<ByteWithPayload> working = input; - auto iter = std::stable_partition(working.begin(), working.end(), is_even); - - if (!std::all_of(working.begin(), iter, is_even)) - return 1; - if (!std::none_of(iter, working.end(), is_even)) - return 2; - if (!std::is_sorted(working.begin(), iter, ByteWithPayload::payload_less())) - return 3; - if (!std::is_sorted(iter, working.end(), ByteWithPayload::payload_less())) - return 4; - if (!fast_is_permutation(input.cbegin(), input.cend(), working.cbegin())) - return 99; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/stable_sort.pass.cpp b/libcxx/test/libcxx-03/fuzzing/stable_sort.pass.cpp deleted file mode 100644 index b493691..0000000 --- a/libcxx/test/libcxx-03/fuzzing/stable_sort.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - std::vector<ByteWithPayload> input; - for (std::size_t i = 0; i < size; ++i) - input.push_back(ByteWithPayload(data[i], i)); - - std::vector<ByteWithPayload> working = input; - std::stable_sort(working.begin(), working.end(), ByteWithPayload::key_less()); - - if (!std::is_sorted(working.begin(), working.end(), ByteWithPayload::key_less())) - return 1; - - auto iter = working.begin(); - while (iter != working.end()) { - auto range = std::equal_range(iter, working.end(), *iter, ByteWithPayload::key_less()); - if (!std::is_sorted(range.first, range.second, ByteWithPayload::total_less())) - return 2; - iter = range.second; - } - if (!fast_is_permutation(input.cbegin(), input.cend(), working.cbegin())) - return 99; - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/unique.pass.cpp b/libcxx/test/libcxx-03/fuzzing/unique.pass.cpp deleted file mode 100644 index e95c617..0000000 --- a/libcxx/test/libcxx-03/fuzzing/unique.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - std::vector<std::uint8_t> working(data, data + size); - std::sort(working.begin(), working.end()); - std::vector<std::uint8_t> results = working; - std::vector<std::uint8_t>::iterator new_end = std::unique(results.begin(), results.end()); - std::vector<std::uint8_t>::iterator it; // scratch iterator - - // Check the size of the unique'd sequence. - // it should only be zero if the input sequence was empty. - if (results.begin() == new_end) - return working.size() == 0 ? 0 : 1; - - // 'results' is sorted - if (!std::is_sorted(results.begin(), new_end)) - return 2; - - // All the elements in 'results' must be different - it = results.begin(); - std::uint8_t prev_value = *it++; - for (; it != new_end; ++it) { - if (*it == prev_value) - return 3; - prev_value = *it; - } - - // Every element in 'results' must be in 'working' - for (it = results.begin(); it != new_end; ++it) - if (std::find(working.begin(), working.end(), *it) == working.end()) - return 4; - - // Every element in 'working' must be in 'results' - for (auto v : working) - if (std::find(results.begin(), new_end, v) == new_end) - return 5; - - return 0; -} diff --git a/libcxx/test/libcxx-03/fuzzing/unique_copy.pass.cpp b/libcxx/test/libcxx-03/fuzzing/unique_copy.pass.cpp deleted file mode 100644 index dfaaa19..0000000 --- a/libcxx/test/libcxx-03/fuzzing/unique_copy.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <iterator> -#include <vector> - -#include "fuzz.h" - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { - std::vector<std::uint8_t> working(data, data + size); - std::sort(working.begin(), working.end()); - std::vector<std::uint8_t> results; - (void)std::unique_copy(working.begin(), working.end(), - std::back_inserter<std::vector<std::uint8_t>>(results)); - std::vector<std::uint8_t>::iterator it; // scratch iterator - - // Check the size of the unique'd sequence. - // it should only be zero if the input sequence was empty. - if (results.size() == 0) - return working.size() == 0 ? 0 : 1; - - // 'results' is sorted - if (!std::is_sorted(results.begin(), results.end())) - return 2; - - // All the elements in 'results' must be different - it = results.begin(); - std::uint8_t prev_value = *it++; - for (; it != results.end(); ++it) { - if (*it == prev_value) - return 3; - prev_value = *it; - } - - // Every element in 'results' must be in 'working' - for (auto v : results) - if (std::find(working.begin(), working.end(), v) == working.end()) - return 4; - - // Every element in 'working' must be in 'results' - for (auto v : working) - if (std::find(results.begin(), results.end(), v) == results.end()) - return 5; - - return 0; -} diff --git a/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py b/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py deleted file mode 100644 index da09092..0000000 --- a/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py +++ /dev/null @@ -1,162 +0,0 @@ -# ===----------------------------------------------------------------------===## -# -# 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 -# -# ===----------------------------------------------------------------------===## -"""Commands used to automate testing gdb pretty printers. - -This script is part of a larger framework to test gdb pretty printers. It -runs the program, detects test cases, checks them, and prints results. - -See gdb_pretty_printer_test.sh.cpp on how to write a test case. - -""" - -from __future__ import print_function -import json -import re -import gdb -import sys - -test_failures = 0 -# Sometimes the inital run command can fail to trace the process. -# (e.g. you don't have ptrace permissions) -# In these cases gdb still sends us an exited event so we cannot -# see what "run" printed to check for a warning message, since -# we get taken to our exit handler before we can look. -# Instead check that at least one test has been run by the time -# we exit. -has_run_tests = False - -has_execute_mi = getattr(gdb, "execute_mi", None) is not None - - -class CheckResult(gdb.Command): - def __init__(self): - super(CheckResult, self).__init__("print_and_compare", gdb.COMMAND_DATA) - - def invoke(self, arg, from_tty): - global has_run_tests - - try: - has_run_tests = True - - # Stack frame is: - # 0. StopForDebugger - # 1. CompareListChildrenToChars, ComparePrettyPrintToChars or ComparePrettyPrintToRegex - # 2. TestCase - compare_frame = gdb.newest_frame().older() - testcase_frame = compare_frame.older() - test_loc = testcase_frame.find_sal() - test_loc_str = test_loc.symtab.filename + ":" + str(test_loc.line) - # Use interactive commands in the correct context to get the pretty - # printed version - - frame_name = compare_frame.name() - if frame_name.startswith("CompareListChildren"): - if has_execute_mi: - value = self._get_children(compare_frame) - else: - print("SKIPPED: " + test_loc_str) - return - else: - value = self._get_value(compare_frame, testcase_frame) - - gdb.newest_frame().select() - expectation_val = compare_frame.read_var("expectation") - check_literal = expectation_val.string(encoding="utf-8") - if "PrettyPrintToRegex" in frame_name: - test_fails = not re.search(check_literal, value) - else: - test_fails = value != check_literal - - if test_fails: - global test_failures - print("FAIL: " + test_loc_str) - print("GDB printed:") - print(" " + repr(value)) - print("Value should match:") - print(" " + repr(check_literal)) - test_failures += 1 - else: - print("PASS: " + test_loc_str) - - except RuntimeError as e: - # At this point, lots of different things could be wrong, so don't try to - # recover or figure it out. Don't exit either, because then it's - # impossible to debug the framework itself. - print("FAIL: Something is wrong in the test framework.") - print(str(e)) - test_failures += 1 - - def _get_children(self, compare_frame): - compare_frame.select() - gdb.execute_mi("-var-create", "value", "*", "value") - r = gdb.execute_mi("-var-list-children", "--simple-values", "value") - gdb.execute_mi("-var-delete", "value") - children = r["children"] - if r["displayhint"] == "map": - r = [ - { - "key": json.loads(children[2 * i]["value"]), - "value": json.loads(children[2 * i + 1]["value"]), - } - for i in range(len(children) // 2) - ] - else: - r = [json.loads(el["value"]) for el in children] - return json.dumps(r, sort_keys=True) - - def _get_value(self, compare_frame, testcase_frame): - compare_frame.select() - frame_name = compare_frame.name() - if frame_name.startswith("ComparePrettyPrint"): - s = gdb.execute("p value", to_string=True) - else: - value_str = str(compare_frame.read_var("value")) - clean_expression_str = value_str.strip("'\"") - testcase_frame.select() - s = gdb.execute("p " + clean_expression_str, to_string=True) - if sys.version_info.major == 2: - s = s.decode("utf-8") - - # Ignore the convenience variable name and newline - return s[s.find("= ") + 2 : -1] - - -def exit_handler(event=None): - global test_failures - global has_run_tests - - if not has_run_tests: - print("FAILED test program did not run correctly, check gdb warnings") - test_failures = -1 - elif test_failures: - print("FAILED %d cases" % test_failures) - exit(test_failures) - - -# Start code executed at load time - -# Disable terminal paging -gdb.execute("set height 0") -gdb.execute("set python print-stack full") - -if has_execute_mi: - gdb.execute_mi("-enable-pretty-printing") - -test_failures = 0 -CheckResult() -test_bp = gdb.Breakpoint("StopForDebugger") -test_bp.enabled = True -test_bp.silent = True -test_bp.commands = "print_and_compare\ncontinue" -# "run" won't return if the program exits; ensure the script regains control. -gdb.events.exited.connect(exit_handler) -gdb.execute("run") -# If the program didn't exit, something went wrong, but we don't -# know what. Fail on exit. -test_failures += 1 -exit_handler(None) diff --git a/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp deleted file mode 100644 index f125cc9..0000000 --- a/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp +++ /dev/null @@ -1,722 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: host-has-gdb-with-python -// REQUIRES: locale.en_US.UTF-8 -// REQUIRES: optimization=none -// UNSUPPORTED: no-localization -// UNSUPPORTED: c++03 - -// TODO: Investigate why this fails on the arm bots -// UNSUPPORTED: target=arm{{.*}} - -// The Android libc++ tests are run on a non-Android host, connected to an -// Android device over adb. gdb needs special support to make this work (e.g. -// gdbclient.py, ndk-gdb.py, gdbserver), and the Android organization doesn't -// support gdb anymore, favoring lldb instead. -// UNSUPPORTED: android - -// This test doesn't work as such on Windows. -// UNSUPPORTED: windows - -// RUN: %{cxx} %{flags} %s -o %t.exe %{compile_flags} -g %{link_flags} -// Ensure locale-independence for unicode tests. -// RUN: env LANG=en_US.UTF-8 %{gdb} -nx -batch -iex "set autoload off" -ex "source %S/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source %S/gdb_pretty_printer_test.py" %t.exe - -#include <bitset> -#include <deque> -#include <list> -#include <map> -#include <memory> -#include <queue> -#include <set> -#include <sstream> -#include <stack> -#include <string> -#include <tuple> -#include <unordered_map> -#include <unordered_set> - -#include "test_macros.h" - -// To write a pretty-printer test: -// -// 1. Declare a variable of the type you want to test -// -// 2. Set its value to something which will test the pretty printer in an -// interesting way. -// -// 3. Call ComparePrettyPrintToChars with that variable, and a "const char*" -// value to compare to the printer's output. -// -// Or -// -// Call ComparePrettyPrintToRegex with that variable, and a "const char*" -// *python* regular expression to match against the printer's output. -// The set of special characters in a Python regular expression overlaps -// with a lot of things the pretty printers print--brackets, for -// example--so take care to escape appropriately. -// -// Alternatively, construct a string that gdb can parse as an expression, -// so that printing the value of the expression will test the pretty printer -// in an interesting way. Then, call CompareExpressionPrettyPrintToChars or -// CompareExpressionPrettyPrintToRegex to compare the printer's output. - -// Avoids setting a breakpoint in every-single instantiation of -// ComparePrettyPrintTo*. Also, make sure neither it, nor the -// variables we need present in the Compare functions are optimized -// away. -#ifdef TEST_COMPILER_GCC -#define OPT_NONE __attribute__((noinline)) -#else -#define OPT_NONE __attribute__((optnone)) -#endif -void StopForDebugger(void *, void *) OPT_NONE; -void StopForDebugger(void *, void *) {} - - -// Prevents the compiler optimizing away the parameter in the caller function. -template <typename Type> -void MarkAsLive(Type &&) OPT_NONE; -template <typename Type> -void MarkAsLive(Type &&) {} - -// In all of the Compare(Expression)PrettyPrintTo(Regex/Chars) functions below, -// the python script sets a breakpoint just before the call to StopForDebugger, -// compares the result to the expectation. -// -// The expectation is a literal string to be matched exactly in -// *PrettyPrintToChars functions, and is a python regular expression in -// *PrettyPrintToRegex functions. -// -// In ComparePrettyPrint* functions, the value is a variable of any type. In -// CompareExpressionPrettyPrint functions, the value is a string expression that -// gdb will parse and print the result. -// -// The python script will print either "PASS", or a detailed failure explanation -// along with the line that has invoke the function. The testing will continue -// in either case. - -template <typename TypeToPrint> void ComparePrettyPrintToChars( - TypeToPrint value, - const char *expectation) { - MarkAsLive(value); - StopForDebugger(&value, &expectation); -} - -template <typename TypeToPrint> void ComparePrettyPrintToRegex( - TypeToPrint value, - const char *expectation) { - MarkAsLive(value); - StopForDebugger(&value, &expectation); -} - -void CompareExpressionPrettyPrintToChars( - std::string value, - const char *expectation) { - MarkAsLive(value); - StopForDebugger(&value, &expectation); -} - -void CompareExpressionPrettyPrintToRegex( - std::string value, - const char *expectation) { - MarkAsLive(value); - StopForDebugger(&value, &expectation); -} - -template <typename TypeToPrint> -void CompareListChildrenToChars(TypeToPrint value, const char* expectation) { - MarkAsLive(value); - StopForDebugger(&value, &expectation); -} - -namespace example { - struct example_struct { - int a = 0; - int arr[1000]; - }; -} - -// If enabled, the self test will "fail"--because we want to be sure it properly -// diagnoses tests that *should* fail. Evaluate the output by hand. -void framework_self_test() { -#ifdef FRAMEWORK_SELF_TEST - // Use the most simple data structure we can. - const char a = 'a'; - - // Tests that should pass - ComparePrettyPrintToChars(a, "97 'a'"); - ComparePrettyPrintToRegex(a, ".*"); - - // Tests that should fail. - ComparePrettyPrintToChars(a, "b"); - ComparePrettyPrintToRegex(a, "b"); -#endif -} - -// A simple pass-through allocator to check that we handle CompressedPair -// correctly. -template <typename T> class UncompressibleAllocator : public std::allocator<T> { - public: - char X; - - template <class U> - struct rebind { - using other = UncompressibleAllocator<U>; - }; -}; - -void string_test() { - std::string short_string("kdjflskdjf"); - // The display_hint "string" adds quotes the printed result. - ComparePrettyPrintToChars(short_string, "\"kdjflskdjf\""); - - std::basic_string<char, std::char_traits<char>, UncompressibleAllocator<char>> - long_string("mehmet bizim dostumuz agzi kirik testimiz"); - ComparePrettyPrintToChars(long_string, - "\"mehmet bizim dostumuz agzi kirik testimiz\""); -} - -namespace a_namespace { -// To test name-lookup in the presence of using inside a namespace. Inside this -// namespace, unqualified string_view variables will appear in the debug info as -// "a_namespace::string_view, rather than "std::string_view". -// -// There is nothing special here about string_view; it's just the data structure -// where lookup with using inside a namespace wasn't always working. - -using string_view = std::string_view; - -void string_view_test() { - std::string_view i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "\"\""); - - std::string source_string("to be or not to be"); - std::string_view to_be(source_string); - ComparePrettyPrintToChars(to_be, "\"to be or not to be\""); - - const char char_arr[] = "what a wonderful world"; - std::string_view wonderful(&char_arr[7], 9); - ComparePrettyPrintToChars(wonderful, "\"wonderful\""); - - const char char_arr1[] = "namespace_stringview"; - string_view namespace_stringview(&char_arr1[10], 10); - ComparePrettyPrintToChars(namespace_stringview, "\"stringview\""); -} -} - -void u16string_test() { - std::u16string test0 = u"Hello World"; - ComparePrettyPrintToChars(test0, "u\"Hello World\""); - std::u16string test1 = u"\U00010196\u20AC\u00A3\u0024"; - ComparePrettyPrintToChars(test1, "u\"\U00010196\u20AC\u00A3\u0024\""); - std::u16string test2 = u"\u0024\u0025\u0026\u0027"; - ComparePrettyPrintToChars(test2, "u\"\u0024\u0025\u0026\u0027\""); - std::u16string test3 = u"mehmet bizim dostumuz agzi kirik testimiz"; - ComparePrettyPrintToChars(test3, - ("u\"mehmet bizim dostumuz agzi kirik testimiz\"")); -} - -void u32string_test() { - std::u32string test0 = U"Hello World"; - ComparePrettyPrintToChars(test0, "U\"Hello World\""); - std::u32string test1 = - U"\U0001d552\U0001d553\U0001d554\U0001d555\U0001d556\U0001d557"; - ComparePrettyPrintToChars( - test1, - ("U\"\U0001d552\U0001d553\U0001d554\U0001d555\U0001d556\U0001d557\"")); - std::u32string test2 = U"\U00004f60\U0000597d"; - ComparePrettyPrintToChars(test2, ("U\"\U00004f60\U0000597d\"")); - std::u32string test3 = U"mehmet bizim dostumuz agzi kirik testimiz"; - ComparePrettyPrintToChars(test3, ("U\"mehmet bizim dostumuz agzi kirik testimiz\"")); -} - -void tuple_test() { - std::tuple<int, int, int> test0(2, 3, 4); - ComparePrettyPrintToChars(test0, "std::tuple containing = {[0] = 2, [1] = 3, [2] = 4}"); - - std::tuple<> test1; - ComparePrettyPrintToChars( - test1, - "empty std::tuple"); -} - -void unique_ptr_test() { - std::unique_ptr<std::string> matilda(new std::string("Matilda")); - ComparePrettyPrintToRegex( - std::move(matilda), - R"(std::unique_ptr<std::string> containing = {__ptr_ = 0x[a-f0-9]+})"); - std::unique_ptr<int> forty_two(new int(42)); - ComparePrettyPrintToRegex(std::move(forty_two), - R"(std::unique_ptr<int> containing = {__ptr_ = 0x[a-f0-9]+})"); - - std::unique_ptr<int> this_is_null; - ComparePrettyPrintToChars(std::move(this_is_null), - R"(std::unique_ptr is nullptr)"); -} - -void bitset_test() { - std::bitset<258> i_am_empty(0); - ComparePrettyPrintToRegex(i_am_empty, "std::bitset<258(u|ul)?>"); - - std::bitset<0> very_empty; - ComparePrettyPrintToRegex(very_empty, "std::bitset<0(u|ul)?>"); - - std::bitset<15> b_000001111111100(1020); - ComparePrettyPrintToRegex(b_000001111111100, - R"(std::bitset<15(u|ul)?> = {\[2\] = 1, \[3\] = 1, \[4\] = 1, \[5\] = 1, \[6\] = 1, )" - R"(\[7\] = 1, \[8\] = 1, \[9\] = 1})"); - - std::bitset<258> b_0_129_132(0); - b_0_129_132[0] = true; - b_0_129_132[129] = true; - b_0_129_132[132] = true; - ComparePrettyPrintToRegex(b_0_129_132, - R"(std::bitset<258(u|ul)?> = {\[0\] = 1, \[129\] = 1, \[132\] = 1})"); -} - -void list_test() { - std::list<int> i_am_empty{}; - ComparePrettyPrintToChars(i_am_empty, "std::list is empty"); - - std::list<int> one_two_three {1, 2, 3}; - ComparePrettyPrintToChars(one_two_three, - "std::list with 3 elements = {1, 2, 3}"); - - std::list<std::string> colors {"red", "blue", "green"}; - ComparePrettyPrintToChars(colors, - R"(std::list with 3 elements = {"red", "blue", "green"})"); -} - -void deque_test() { - std::deque<int> i_am_empty{}; - ComparePrettyPrintToChars(i_am_empty, "std::deque is empty"); - - std::deque<int> one_two_three {1, 2, 3}; - ComparePrettyPrintToChars(one_two_three, - "std::deque with 3 elements = {1, 2, 3}"); - - std::deque<example::example_struct> bfg; - for (int i = 0; i < 10; ++i) { - example::example_struct current; - current.a = i; - bfg.push_back(current); - } - for (int i = 0; i < 3; ++i) { - bfg.pop_front(); - } - for (int i = 0; i < 3; ++i) { - bfg.pop_back(); - } - ComparePrettyPrintToRegex(bfg, - "std::deque with 4 elements = {" - "{a = 3, arr = {[^}]+}}, " - "{a = 4, arr = {[^}]+}}, " - "{a = 5, arr = {[^}]+}}, " - "{a = 6, arr = {[^}]+}}}"); -} - -void map_test() { - std::map<int, int> i_am_empty{}; - ComparePrettyPrintToChars(i_am_empty, "std::map is empty"); - - std::map<int, std::string> one_two_three; - one_two_three.insert({1, "one"}); - one_two_three.insert({2, "two"}); - one_two_three.insert({3, "three"}); - ComparePrettyPrintToChars(one_two_three, - "std::map with 3 elements = " - R"({[1] = "one", [2] = "two", [3] = "three"})"); - - std::map<int, example::example_struct> bfg; - for (int i = 0; i < 4; ++i) { - example::example_struct current; - current.a = 17 * i; - bfg.insert({i, current}); - } - ComparePrettyPrintToRegex(bfg, - R"(std::map with 4 elements = {)" - R"(\[0\] = {a = 0, arr = {[^}]+}}, )" - R"(\[1\] = {a = 17, arr = {[^}]+}}, )" - R"(\[2\] = {a = 34, arr = {[^}]+}}, )" - R"(\[3\] = {a = 51, arr = {[^}]+}}})"); -} - -void multimap_test() { - std::multimap<int, int> i_am_empty{}; - ComparePrettyPrintToChars(i_am_empty, "std::multimap is empty"); - - std::multimap<int, std::string> one_two_three; - one_two_three.insert({1, "one"}); - one_two_three.insert({3, "three"}); - one_two_three.insert({1, "ein"}); - one_two_three.insert({2, "two"}); - one_two_three.insert({2, "zwei"}); - one_two_three.insert({1, "bir"}); - - ComparePrettyPrintToChars(one_two_three, - "std::multimap with 6 elements = " - R"({[1] = "one", [1] = "ein", [1] = "bir", )" - R"([2] = "two", [2] = "zwei", [3] = "three"})"); -} - -void queue_test() { - std::queue<int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::queue wrapping: std::deque is empty"); - - std::queue<int> one_two_three(std::deque<int>{1, 2, 3}); - ComparePrettyPrintToChars( - one_two_three, - "std::queue wrapping: " - "std::deque with 3 elements = {1, 2, 3}"); -} - -void priority_queue_test() { - std::priority_queue<int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::priority_queue wrapping: std::vector of length 0, capacity 0"); - - std::priority_queue<int> one_two_three; - one_two_three.push(11111); - one_two_three.push(22222); - one_two_three.push(33333); - - ComparePrettyPrintToRegex( - one_two_three, - R"(std::priority_queue wrapping: )" - R"(std::vector of length 3, capacity 3 = {33333)"); - - ComparePrettyPrintToRegex(one_two_three, ".*11111.*"); - ComparePrettyPrintToRegex(one_two_three, ".*22222.*"); -} - -void set_test() { - std::set<int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::set is empty"); - - std::set<int> one_two_three {3, 1, 2}; - ComparePrettyPrintToChars(one_two_three, - "std::set with 3 elements = {1, 2, 3}"); - - std::set<std::pair<int, int>> prime_pairs { - std::make_pair(3, 5), std::make_pair(5, 7), std::make_pair(3, 5)}; - - ComparePrettyPrintToChars(prime_pairs, - "std::set with 2 elements = {" - "{first = 3, second = 5}, {first = 5, second = 7}}"); - - using using_set = std::set<int>; - using_set other{1, 2, 3}; - ComparePrettyPrintToChars(other, "std::set with 3 elements = {1, 2, 3}"); -} - -void stack_test() { - std::stack<int> test0; - ComparePrettyPrintToChars(test0, "std::stack wrapping: std::deque is empty"); - test0.push(5); - test0.push(6); - ComparePrettyPrintToChars(test0, "std::stack wrapping: std::deque with 2 elements = {5, 6}"); - std::stack<bool> test1; - test1.push(true); - test1.push(false); - ComparePrettyPrintToChars(test1, "std::stack wrapping: std::deque with 2 elements = {true, false}"); - - std::stack<std::string> test2; - test2.push("Hello"); - test2.push("World"); - ComparePrettyPrintToChars( - test2, - "std::stack wrapping: std::deque with 2 elements " - "= {\"Hello\", \"World\"}"); -} - -void multiset_test() { - std::multiset<int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::multiset is empty"); - - std::multiset<std::string> one_two_three {"1:one", "2:two", "3:three", "1:one"}; - ComparePrettyPrintToChars(one_two_three, - "std::multiset with 4 elements = {" - R"("1:one", "1:one", "2:two", "3:three"})"); -} - -void vector_test() { - std::vector<bool> test0 = {true, false}; - ComparePrettyPrintToRegex(test0, - "std::vector<bool> of " - "length 2, capacity (32|64) = {1, 0}"); - for (int i = 0; i < 31; ++i) { - test0.push_back(true); - test0.push_back(false); - } - ComparePrettyPrintToRegex( - test0, - "std::vector<bool> of length 64, " - "capacity 64 = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, " - "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, " - "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}"); - test0.push_back(true); - ComparePrettyPrintToRegex( - test0, - "std::vector<bool> of length 65, " - "capacity (96|128) = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, " - "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, " - "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}"); - - std::vector<int> test1; - ComparePrettyPrintToChars(test1, "std::vector of length 0, capacity 0"); - - std::vector<int> test2 = {5, 6, 7}; - ComparePrettyPrintToChars(test2, - "std::vector of length " - "3, capacity 3 = {5, 6, 7}"); - - std::vector<int, UncompressibleAllocator<int>> test3({7, 8}); - ComparePrettyPrintToChars(std::move(test3), - "std::vector of length " - "2, capacity 2 = {7, 8}"); -} - -void set_iterator_test() { - std::set<int> one_two_three {1111, 2222, 3333}; - auto it = one_two_three.find(2222); - MarkAsLive(it); - CompareExpressionPrettyPrintToRegex("it", - R"(std::__tree_const_iterator = {\[0x[a-f0-9]+\] = 2222})"); - - auto not_found = one_two_three.find(1234); - MarkAsLive(not_found); - // Because the end_node is not easily detected, just be sure it doesn't crash. - CompareExpressionPrettyPrintToRegex("not_found", - R"(std::__tree_const_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error reading variable:.*>))"); -} - -void map_iterator_test() { - std::map<int, std::string> one_two_three; - one_two_three.insert({1, "one"}); - one_two_three.insert({2, "two"}); - one_two_three.insert({3, "three"}); - auto it = one_two_three.begin(); - MarkAsLive(it); - CompareExpressionPrettyPrintToRegex("it", - R"(std::__map_iterator = )" - R"({\[0x[a-f0-9]+\] = {first = 1, second = "one"}})"); - - auto not_found = one_two_three.find(7); - MarkAsLive(not_found); - // Because the end_node is not easily detected, just be sure it doesn't crash. - CompareExpressionPrettyPrintToRegex( - "not_found", R"(std::__map_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error reading variable:.*>))"); -} - -void unordered_set_test() { - std::unordered_set<int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::unordered_set is empty"); - - std::unordered_set<int> numbers {12345, 67890, 222333, 12345}; - numbers.erase(numbers.find(222333)); - ComparePrettyPrintToRegex(numbers, "std::unordered_set with 2 elements = "); - ComparePrettyPrintToRegex(numbers, ".*12345.*"); - ComparePrettyPrintToRegex(numbers, ".*67890.*"); - - std::unordered_set<std::string> colors {"red", "blue", "green"}; - ComparePrettyPrintToRegex(colors, "std::unordered_set with 3 elements = "); - ComparePrettyPrintToRegex(colors, R"(.*"red".*)"); - ComparePrettyPrintToRegex(colors, R"(.*"blue".*)"); - ComparePrettyPrintToRegex(colors, R"(.*"green".*)"); -} - -void unordered_multiset_test() { - std::unordered_multiset<int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::unordered_multiset is empty"); - - std::unordered_multiset<int> numbers {12345, 67890, 222333, 12345}; - ComparePrettyPrintToRegex(numbers, - "std::unordered_multiset with 4 elements = "); - ComparePrettyPrintToRegex(numbers, ".*12345.*12345.*"); - ComparePrettyPrintToRegex(numbers, ".*67890.*"); - ComparePrettyPrintToRegex(numbers, ".*222333.*"); - - std::unordered_multiset<std::string> colors {"red", "blue", "green", "red"}; - ComparePrettyPrintToRegex(colors, - "std::unordered_multiset with 4 elements = "); - ComparePrettyPrintToRegex(colors, R"(.*"red".*"red".*)"); - ComparePrettyPrintToRegex(colors, R"(.*"blue".*)"); - ComparePrettyPrintToRegex(colors, R"(.*"green".*)"); -} - -void unordered_map_test() { - std::unordered_map<int, int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::unordered_map is empty"); - - std::unordered_map<int, std::string> one_two_three; - one_two_three.insert({1, "one"}); - one_two_three.insert({2, "two"}); - one_two_three.insert({3, "three"}); - ComparePrettyPrintToRegex(one_two_three, - "std::unordered_map with 3 elements = "); - ComparePrettyPrintToRegex(one_two_three, R"(.*\[1\] = "one".*)"); - ComparePrettyPrintToRegex(one_two_three, R"(.*\[2\] = "two".*)"); - ComparePrettyPrintToRegex(one_two_three, R"(.*\[3\] = "three".*)"); -} - -void unordered_multimap_test() { - std::unordered_multimap<int, int> i_am_empty; - ComparePrettyPrintToChars(i_am_empty, "std::unordered_multimap is empty"); - - std::unordered_multimap<int, std::string> one_two_three; - one_two_three.insert({1, "one"}); - one_two_three.insert({2, "two"}); - one_two_three.insert({3, "three"}); - one_two_three.insert({2, "two"}); - ComparePrettyPrintToRegex(one_two_three, - "std::unordered_multimap with 4 elements = "); - ComparePrettyPrintToRegex(one_two_three, R"(.*\[1\] = "one".*)"); - ComparePrettyPrintToRegex(one_two_three, R"(.*\[2\] = "two".*\[2\] = "two")"); - ComparePrettyPrintToRegex(one_two_three, R"(.*\[3\] = "three".*)"); -} - -void unordered_map_iterator_test() { - std::unordered_map<int, int> ones_to_eights; - ones_to_eights.insert({1, 8}); - ones_to_eights.insert({11, 88}); - ones_to_eights.insert({111, 888}); - - auto ones_to_eights_begin = ones_to_eights.begin(); - MarkAsLive(ones_to_eights_begin); - CompareExpressionPrettyPrintToRegex("ones_to_eights_begin", - R"(std::__hash_map_iterator = {\[1+\] = 8+})"); - - auto not_found = ones_to_eights.find(5); - MarkAsLive(not_found); - CompareExpressionPrettyPrintToRegex("not_found", - R"(std::__hash_map_iterator = end\(\))"); -} - -void unordered_set_iterator_test() { - std::unordered_set<int> ones; - ones.insert(111); - ones.insert(1111); - ones.insert(11111); - - auto ones_begin = ones.begin(); - MarkAsLive(ones_begin); - CompareExpressionPrettyPrintToRegex("ones_begin", - R"(std::__hash_const_iterator = {1+})"); - - auto not_found = ones.find(5); - MarkAsLive(not_found); - CompareExpressionPrettyPrintToRegex("not_found", - R"(std::__hash_const_iterator = end\(\))"); -} - -// Check that libc++ pretty printers do not handle pointers. -void pointer_negative_test() { - int abc = 123; - int *int_ptr = &abc; - // Check that the result is equivalent to "p/r int_ptr" command. - ComparePrettyPrintToRegex(int_ptr, R"(\(int \*\) 0x[a-f0-9]+)"); -} - -void shared_ptr_test() { - // Shared ptr tests while using test framework call another function - // due to which there is one more count for the pointer. Hence, all the - // following tests are testing with expected count plus 1. - std::shared_ptr<const int> test0 = std::make_shared<const int>(5); - // The python regular expression matcher treats newlines as significant, so - // these regular expressions should be on one line. - ComparePrettyPrintToRegex( - test0, - R"(std::shared_ptr<int> count [2\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); - - std::shared_ptr<const int> test1(test0); - ComparePrettyPrintToRegex( - test1, - R"(std::shared_ptr<int> count [3\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); - - { - std::weak_ptr<const int> test2 = test1; - ComparePrettyPrintToRegex( - test0, - R"(std::shared_ptr<int> count [3\?], weak [1\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); - } - - ComparePrettyPrintToRegex( - test0, - R"(std::shared_ptr<int> count [3\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); - - std::shared_ptr<const int> test3; - ComparePrettyPrintToChars(test3, "std::shared_ptr is nullptr"); -} - -void streampos_test() { - std::streampos test0 = 67; - ComparePrettyPrintToRegex(test0, "^std::fpos with stream offset:67( with state: {count:0 value:0})?$"); - std::istringstream input("testing the input stream here"); - std::streampos test1 = input.tellg(); - ComparePrettyPrintToRegex(test1, "^std::fpos with stream offset:0( with state: {count:0 value:0})?$"); - std::unique_ptr<char[]> buffer(new char[5]); - input.read(buffer.get(), 5); - test1 = input.tellg(); - ComparePrettyPrintToRegex(test1, "^std::fpos with stream offset:5( with state: {count:0 value:0})?$"); -} - -void mi_mode_test() { - std::map<int, std::string> one_two_three_map; - one_two_three_map.insert({1, "one"}); - one_two_three_map.insert({2, "two"}); - one_two_three_map.insert({3, "three"}); - CompareListChildrenToChars( - one_two_three_map, R"([{"key": 1, "value": "one"}, {"key": 2, "value": "two"}, {"key": 3, "value": "three"}])"); - - std::unordered_map<int, std::string> one_two_three_umap; - one_two_three_umap.insert({3, "three"}); - one_two_three_umap.insert({2, "two"}); - one_two_three_umap.insert({1, "one"}); - CompareListChildrenToChars( - one_two_three_umap, R"([{"key": 3, "value": "three"}, {"key": 2, "value": "two"}, {"key": 1, "value": "one"}])"); - - std::deque<int> one_two_three_deque{1, 2, 3}; - CompareListChildrenToChars(one_two_three_deque, "[1, 2, 3]"); -} - -int main(int, char**) { - framework_self_test(); - - string_test(); - a_namespace::string_view_test(); - - //u16string_test(); - u32string_test(); - tuple_test(); - unique_ptr_test(); - shared_ptr_test(); - bitset_test(); - list_test(); - deque_test(); - map_test(); - multimap_test(); - queue_test(); - priority_queue_test(); - stack_test(); - set_test(); - multiset_test(); - vector_test(); - set_iterator_test(); - map_iterator_test(); - unordered_set_test(); - unordered_multiset_test(); - unordered_map_test(); - unordered_multimap_test(); - unordered_map_iterator_test(); - unordered_set_iterator_test(); - pointer_negative_test(); - streampos_test(); - mi_mode_test(); - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp b/libcxx/test/libcxx-03/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp deleted file mode 100644 index 1acbed5..0000000 --- a/libcxx/test/libcxx-03/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: availability-filesystem-missing -// UNSUPPORTED: no-filesystem -// ADDITIONAL_COMPILE_FLAGS: -I %{libcxx-dir}/src - -// This test relies on calling functions from the libcxx internal headers -// of <filesystem>; the Windows implementation uses different -// internals and doesn't provide the same set_file_times function as for -// other platforms. -// UNSUPPORTED: windows - -// This test assumes that time is stored as a 64 bit value when on MVS it is stored as 32 bit -// XFAIL: target={{.+}}-zos{{.*}} - -// <filesystem> - -// class directory_entry - -#include <filesystem> -#include <type_traits> -#include <cassert> - -#include "assert_macros.h" -#include "test_macros.h" -#include "filesystem_test_helper.h" - -#include "filesystem/time_utils.h" - -namespace fs = std::filesystem; -using namespace fs::detail; - -static void last_write_time_not_representable_error() { - using namespace fs; - using namespace std::chrono; - scoped_test_env env; - const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); - - TimeSpec ToTime; - ToTime.tv_sec = std::numeric_limits<decltype(ToTime.tv_sec)>::max(); - ToTime.tv_nsec = duration_cast<nanoseconds>(seconds(1)).count() - 1; - - std::array<TimeSpec, 2> TS = {ToTime, ToTime}; - - file_time_type old_time = last_write_time(file); - directory_entry ent(file); - - file_time_type start_time = file_time_type::clock::now() - hours(1); - last_write_time(file, start_time); - - assert(ent.last_write_time() == old_time); - - bool IsRepresentable = true; - file_time_type rep_value; - { - std::error_code ec; - assert(!set_file_times(file, TS, ec)); - ec.clear(); - rep_value = last_write_time(file, ec); - IsRepresentable = !bool(ec); - } - - if (!IsRepresentable) { - std::error_code rec = GetTestEC(); - ent.refresh(rec); - assert(!rec); - - const std::errc expected_err = std::errc::value_too_large; - - std::error_code ec = GetTestEC(); - assert(ent.last_write_time(ec) == file_time_type::min()); - assert(ErrorIs(ec, expected_err)); - - ec = GetTestEC(); - assert(last_write_time(file, ec) == file_time_type::min()); - assert(ErrorIs(ec, expected_err)); - - ExceptionChecker CheckExcept(file, expected_err, - "directory_entry::last_write_time"); - TEST_VALIDATE_EXCEPTION(filesystem_error, CheckExcept, - ent.last_write_time()); - - } else { - ent.refresh(); - - std::error_code ec = GetTestEC(); - assert(ent.last_write_time(ec) == rep_value); - assert(!ec); - } -} - -int main(int, char**) { - last_write_time_not_representable_error(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp b/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp deleted file mode 100644 index 3804795..0000000 --- a/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.itr/assert.iterator.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <filesystem> - -// class path - -#include <filesystem> -#include <iterator> -#include <type_traits> -#include <cassert> - -#include "check_assertion.h" -namespace fs = std::filesystem; - -int main(int, char**) { - // Test incrementing/decrementing a singular iterator - { - fs::path::iterator singular; - TEST_LIBCPP_ASSERT_FAILURE(++singular, "attempting to increment a singular iterator"); - TEST_LIBCPP_ASSERT_FAILURE(--singular, "attempting to decrement a singular iterator"); - } - - // Test incrementing the end iterator - { - fs::path p("foo/bar"); - auto it = p.begin(); - TEST_LIBCPP_ASSERT_FAILURE(--it, "attempting to decrement the begin iterator"); - } - - // Test incrementing the end iterator - { - fs::path p("foo/bar"); - auto it = p.end(); - TEST_LIBCPP_ASSERT_FAILURE(++it, "attempting to increment the end iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp deleted file mode 100644 index 8a443b9..0000000 --- a/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp +++ /dev/null @@ -1,173 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: availability-filesystem-missing - -// These tests require locale for non-char paths -// UNSUPPORTED: no-localization - -// <filesystem> - -// class path - -// template <class ECharT, class Traits = char_traits<ECharT>, -// class Allocator = allocator<ECharT>> -// basic_string<ECharT, Traits, Allocator> -// string(const Allocator& a = Allocator()) const; - -#include <filesystem> -#include <type_traits> -#include <cassert> - -#include "count_new.h" -#include "make_string.h" -#include "min_allocator.h" -#include "test_iterators.h" -#include "test_macros.h" -namespace fs = std::filesystem; - -// the SSO is always triggered for strings of size 2. -MultiStringType shortString = MKSTR("a"); -MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); - -template <class CharT> -void doShortStringTest(MultiStringType const& MS) { - using namespace fs; - using Ptr = CharT const*; - using Str = std::basic_string<CharT>; - using Alloc = std::allocator<CharT>; - Ptr value = MS; - const path p((const char*)MS); -#ifdef _WIN32 - // On Windows, charset conversions cause allocations outside of the - // provided allocator, but accessing the native type should work without - // extra allocations. - bool DisableAllocations = std::is_same<CharT, path::value_type>::value; -#else - // On other platforms, these methods only use the provided allocator, and - // no extra allocations should be done. - bool DisableAllocations = true; -#endif - { - DisableAllocationGuard g(DisableAllocations); - Str s = p.string<CharT>(); - assert(s == value); - Str s2 = p.string<CharT>(Alloc{}); - assert(s2 == value); - } - using MAlloc = malloc_allocator<CharT>; - MAlloc::reset(); - { - using Traits = std::char_traits<CharT>; - using AStr = std::basic_string<CharT, Traits, MAlloc>; - DisableAllocationGuard g(DisableAllocations); - AStr s = p.string<CharT, Traits, MAlloc>(); - assert(s == value); - assert(MAlloc::alloc_count == 0); - assert(MAlloc::outstanding_alloc() == 0); - } - MAlloc::reset(); - { // Other allocator - provided copy - using Traits = std::char_traits<CharT>; - using AStr = std::basic_string<CharT, Traits, MAlloc>; - DisableAllocationGuard g(DisableAllocations); - MAlloc a; - // don't allow another allocator to be default constructed. - MAlloc::disable_default_constructor = true; - AStr s = p.string<CharT, Traits, MAlloc>(a); - assert(s == value); - assert(MAlloc::alloc_count == 0); - assert(MAlloc::outstanding_alloc() == 0); - } - MAlloc::reset(); -} - -template <class CharT> -void doLongStringTest(MultiStringType const& MS) { - using namespace fs; - using Ptr = CharT const*; - using Str = std::basic_string<CharT>; - Ptr value = MS; - const path p((const char*)MS); - { // Default allocator - using Alloc = std::allocator<CharT>; - Str s = p.string<CharT>(); - assert(s == value); - Str s2 = p.string<CharT>(Alloc{}); - assert(s2 == value); - } - using MAlloc = malloc_allocator<CharT>; - MAlloc::reset(); -#ifdef _WIN32 - // On Windows, charset conversions cause allocations outside of the - // provided allocator, but accessing the native type should work without - // extra allocations. - bool DisableAllocations = std::is_same<CharT, path::value_type>::value; -#else - // On other platforms, these methods only use the provided allocator, and - // no extra allocations should be done. - bool DisableAllocations = true; -#endif - - { // Other allocator - default construct - using Traits = std::char_traits<CharT>; - using AStr = std::basic_string<CharT, Traits, MAlloc>; - DisableAllocationGuard g(DisableAllocations); - AStr s = p.string<CharT, Traits, MAlloc>(); - assert(s == value); - assert(MAlloc::alloc_count > 0); - assert(MAlloc::outstanding_alloc() == 1); - } - MAlloc::reset(); - { // Other allocator - provided copy - using Traits = std::char_traits<CharT>; - using AStr = std::basic_string<CharT, Traits, MAlloc>; - DisableAllocationGuard g(DisableAllocations); - MAlloc a; - // don't allow another allocator to be default constructed. - MAlloc::disable_default_constructor = true; - AStr s = p.string<CharT, Traits, MAlloc>(a); - assert(s == value); - assert(MAlloc::alloc_count > 0); - assert(MAlloc::outstanding_alloc() == 1); - } - MAlloc::reset(); - ///////////////////////////////////////////////////////////////////////////// -} - -int main(int, char**) -{ - using namespace fs; - { - auto const& S = shortString; - doShortStringTest<char>(S); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - doShortStringTest<wchar_t>(S); -#endif - doShortStringTest<char16_t>(S); - doShortStringTest<char32_t>(S); -#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t) - doShortStringTest<char8_t>(S); -#endif - } - { - auto const& S = longString; - doLongStringTest<char>(S); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - doLongStringTest<wchar_t>(S); -#endif - doLongStringTest<char16_t>(S); - doLongStringTest<char32_t>(S); -#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t) - doLongStringTest<char8_t>(S); -#endif - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.req/is_pathable.pass.cpp b/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.req/is_pathable.pass.cpp deleted file mode 100644 index e095d75..0000000 --- a/libcxx/test/libcxx-03/input.output/filesystems/class.path/path.req/is_pathable.pass.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <filesystem> - -// template <class Tp> struct __is_pathable - -// [path.req] -// In addition to the requirements (5), function template parameters named -// `Source` shall be one of: -// * basic_string<_ECharT, _Traits, _Alloc> -// * InputIterator with a value_type of _ECharT -// * A character array, which points to a NTCTS after array-to-pointer decay. - -#include <filesystem> -#include <type_traits> -#include <cassert> - -#include "test_macros.h" -#include "test_iterators.h" -#include "min_allocator.h" -#include "constexpr_char_traits.h" -namespace fs = std::filesystem; - -using fs::__is_pathable; - -template <class Tp> -struct Identity { typedef Tp type; }; - -template <class Source> -Identity<Source> CheckSourceType(Source const&); - -template <class Tp> -using GetSourceType = typename decltype(CheckSourceType(std::declval<Tp>()))::type; - -template <class Tp, class Exp, - class ExpQual = typename std::remove_const<Exp>::type> -using CheckPass = std::is_same<ExpQual, GetSourceType<Tp>>; - -template <class Source> -using CheckPassSource = std::integral_constant<bool, - CheckPass<Source&, Source>::value && - CheckPass<Source const&, Source>::value && - CheckPass<Source&&, Source>::value && - CheckPass<Source const&&, Source>::value - >; - -template <class CharT> -struct MakeTestType { - using value_type = CharT; - using string_type = std::basic_string<CharT>; - using string_type2 = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>; - using string_view_type = std::basic_string_view<CharT>; - using string_view_type2 = std::basic_string_view<CharT, constexpr_char_traits<CharT>>; - using cstr_type = CharT* const; - using const_cstr_type = const CharT*; - using array_type = CharT[25]; - using const_array_type = const CharT[25]; - using iter_type = cpp17_input_iterator<CharT*>; - using bad_iter_type = cpp17_input_iterator<signed char*>; - - template <class TestT> - static void AssertPathable() { - static_assert(__is_pathable<TestT>::value, ""); - static_assert(CheckPassSource<TestT>::value, "cannot pass as Source const&"); - ASSERT_SAME_TYPE(CharT, typename __is_pathable<TestT>::__char_type); - } - - template <class TestT> - static void AssertNotPathable() { - static_assert(!__is_pathable<TestT>::value, ""); - } - - static void Test() { - AssertPathable<string_type>(); - AssertPathable<string_type2>(); - AssertPathable<string_view_type>(); - AssertPathable<string_view_type2>(); - AssertPathable<cstr_type>(); - AssertPathable<const_cstr_type>(); - AssertPathable<array_type>(); - AssertPathable<const_array_type>(); - AssertPathable<iter_type>(); - - AssertNotPathable<CharT>(); - AssertNotPathable<bad_iter_type>(); - AssertNotPathable<signed char*>(); - } -}; - -int main(int, char**) { - MakeTestType<char>::Test(); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - MakeTestType<wchar_t>::Test(); -#endif - MakeTestType<char16_t>::Test(); - MakeTestType<char32_t>::Test(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/filesystems/convert_file_time.pass.cpp b/libcxx/test/libcxx-03/input.output/filesystems/convert_file_time.pass.cpp deleted file mode 100644 index c501969..0000000 --- a/libcxx/test/libcxx-03/input.output/filesystems/convert_file_time.pass.cpp +++ /dev/null @@ -1,309 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: availability-filesystem-missing - -// <filesystem> - -// typedef TrivialClock file_time_type; - -// ADDITIONAL_COMPILE_FLAGS: -I %{libcxx-dir}/src -Wno-macro-redefined - -#include <cassert> -#include <chrono> -#include <cstddef> -#include <filesystem> -#include <limits> -#include <string> -#include <type_traits> - -#include "filesystem/time_utils.h" - -#ifndef __SIZEOF_INT128__ -#define TEST_HAS_NO_INT128_T -#endif - -using namespace std::chrono; -namespace fs = std::filesystem; -using fs::file_time_type; -using fs::detail::time_util; - -#ifdef TEST_HAS_NO_INT128_T -static_assert(sizeof(fs::file_time_type::rep) <= 8, ""); -#endif - -enum TestKind { TK_128Bit, TK_64Bit, TK_32Bit, TK_FloatingPoint }; - -template <class TimeT> -constexpr TestKind getTimeTTestKind() { - if (sizeof(TimeT) == 8 && !std::is_floating_point<TimeT>::value) - return TK_64Bit; - else if (sizeof(TimeT) == 4 && !std::is_floating_point<TimeT>::value) - return TK_32Bit; - else if (std::is_floating_point<TimeT>::value) - return TK_FloatingPoint; - else - assert(false && "test kind not supported"); -} -template <class FileTimeT> -constexpr TestKind getFileTimeTestKind() { - using Rep = typename FileTimeT::rep; - if (std::is_floating_point<Rep>::value) - return TK_FloatingPoint; - else if (sizeof(Rep) == 16) - return TK_128Bit; - else if (sizeof(Rep) == 8) - return TK_64Bit; - else - assert(false && "test kind not supported"); -} - -template <class FileTimeT, class TimeT, class TimeSpecT, - class Base = time_util<FileTimeT, TimeT, TimeSpecT>, - TestKind = getTimeTTestKind<TimeT>(), - TestKind = getFileTimeTestKind<FileTimeT>()> -struct test_case; - -template <class FileTimeT, class TimeT, class TimeSpecT, class Base> -struct test_case<FileTimeT, TimeT, TimeSpecT, Base, TK_64Bit, TK_128Bit> - : public Base { - - using Base::convert_from_timespec; - using Base::convert_to_timespec; - using Base::is_representable; - using Base::max_nsec; - using Base::max_seconds; - using Base::min_nsec_timespec; - using Base::min_seconds; - - static constexpr auto max_time_t = std::numeric_limits<TimeT>::max(); - static constexpr auto min_time_t = std::numeric_limits<TimeT>::min(); - - static constexpr bool test_timespec() { - static_assert(is_representable(TimeSpecT{max_time_t, 0}), ""); - static_assert(is_representable(TimeSpecT{max_time_t, 999999999}), ""); - static_assert(is_representable(TimeSpecT{max_time_t, 1000000000}), ""); - static_assert(is_representable(TimeSpecT{max_time_t, max_nsec}), ""); - - static_assert(is_representable(TimeSpecT{min_time_t, 0}), ""); - static_assert(is_representable(TimeSpecT{min_time_t, 999999999}), ""); - static_assert(is_representable(TimeSpecT{min_time_t, 1000000000}), ""); - static_assert(is_representable(TimeSpecT{min_time_t, min_nsec_timespec}), - ""); - - return true; - } - - static constexpr bool test_file_time_type() { - // This kinda sucks. Oh well. - static_assert(!Base::is_representable(FileTimeT::max()), ""); - static_assert(!Base::is_representable(FileTimeT::min()), ""); - return true; - } - - static constexpr bool check_round_trip(TimeSpecT orig) { - TimeSpecT new_ts = {}; - FileTimeT out = convert_from_timespec(orig); - assert(convert_to_timespec(new_ts, out)); - return new_ts.tv_sec == orig.tv_sec && new_ts.tv_nsec == orig.tv_nsec; - } - - static constexpr bool test_convert_timespec() { - static_assert(check_round_trip({0, 0}), ""); - static_assert(check_round_trip({0, 1}), ""); - static_assert(check_round_trip({1, 1}), ""); - static_assert(check_round_trip({-1, 1}), ""); - static_assert(check_round_trip({max_time_t, max_nsec}), ""); - static_assert(check_round_trip({max_time_t, 123}), ""); - static_assert(check_round_trip({min_time_t, min_nsec_timespec}), ""); - static_assert(check_round_trip({min_time_t, 123}), ""); - return true; - } - - static bool test() { - static_assert(test_timespec(), ""); - static_assert(test_file_time_type(), ""); - static_assert(test_convert_timespec(), ""); - return true; - } -}; - -template <class FileTimeT, class TimeT, class TimeSpecT, class Base> -struct test_case<FileTimeT, TimeT, TimeSpecT, Base, TK_32Bit, TK_128Bit> - : public test_case<FileTimeT, TimeT, TimeSpecT, Base, TK_64Bit, TK_128Bit> { - -}; - -template <class FileTimeT, class TimeT, class TimeSpecT, class Base> -struct test_case<FileTimeT, TimeT, TimeSpecT, Base, TK_64Bit, TK_64Bit> - : public Base { - - using Base::convert_from_timespec; - using Base::is_representable; - using Base::max_nsec; - using Base::max_seconds; - using Base::min_nsec_timespec; - using Base::min_seconds; - - static constexpr auto max_time_t = std::numeric_limits<TimeT>::max(); - static constexpr auto min_time_t = std::numeric_limits<TimeT>::min(); - - static constexpr bool test_timespec() { - static_assert(is_representable(TimeSpecT{max_seconds, max_nsec}), ""); - static_assert(!is_representable(TimeSpecT{max_seconds + 1, 0}), ""); - static_assert(!is_representable(TimeSpecT{max_seconds, max_nsec + 1}), ""); - static_assert(!is_representable(TimeSpecT{max_time_t, 0}), ""); - static_assert(is_representable(TimeSpecT{min_seconds, 0}), ""); - static_assert( - is_representable(TimeSpecT{min_seconds - 1, min_nsec_timespec}), ""); - static_assert( - is_representable(TimeSpecT{min_seconds - 1, min_nsec_timespec + 1}), - ""); - static_assert( - !is_representable(TimeSpecT{min_seconds - 1, min_nsec_timespec - 1}), - ""); - static_assert(!is_representable(TimeSpecT{min_time_t, 999999999}), ""); - return true; - } - - static constexpr bool test_file_time_type() { - static_assert(Base::is_representable(FileTimeT::max()), ""); - static_assert(Base::is_representable(FileTimeT::min()), ""); - return true; - } - - static constexpr bool test_convert_timespec() { - static_assert(convert_from_timespec(TimeSpecT{max_seconds, max_nsec}) == - FileTimeT::max(), - ""); - static_assert(convert_from_timespec(TimeSpecT{max_seconds, max_nsec - 1}) < - FileTimeT::max(), - ""); - static_assert(convert_from_timespec(TimeSpecT{max_seconds - 1, 999999999}) < - FileTimeT::max(), - ""); - static_assert(convert_from_timespec(TimeSpecT{ - min_seconds - 1, min_nsec_timespec}) == FileTimeT::min(), - ""); - static_assert(convert_from_timespec( - TimeSpecT{min_seconds - 1, min_nsec_timespec + 1}) > - FileTimeT::min(), - ""); - static_assert(convert_from_timespec(TimeSpecT{min_seconds, 0}) > - FileTimeT::min(), - ""); - return true; - } - - static bool test() { - static_assert(test_timespec(), ""); - static_assert(test_file_time_type(), ""); - static_assert(test_convert_timespec(), ""); - return true; - } -}; - -template <class FileTimeT, class TimeT, class TimeSpecT, class Base> -struct test_case<FileTimeT, TimeT, TimeSpecT, Base, TK_32Bit, TK_64Bit> - : public Base { - static constexpr auto max_time_t = std::numeric_limits<TimeT>::max(); - static constexpr auto min_time_t = std::numeric_limits<TimeT>::min(); - - using Base::convert_from_timespec; - using Base::is_representable; - using Base::max_nsec; - using Base::max_seconds; - using Base::min_nsec_timespec; - using Base::min_seconds; - - static constexpr bool test_timespec() { - static_assert(is_representable(TimeSpecT{max_time_t, 999999999}), ""); - static_assert(is_representable(TimeSpecT{max_time_t, 1000000000}), ""); - static_assert(is_representable(TimeSpecT{min_time_t, 0}), ""); - return true; - } - - static constexpr bool test_file_time_type() { - static_assert(!is_representable(FileTimeT::max()), ""); - static_assert(!is_representable(FileTimeT::min()), ""); - static_assert(is_representable(FileTimeT(seconds(max_time_t))), ""); - static_assert(is_representable(FileTimeT(seconds(min_time_t))), ""); - return true; - } - - static constexpr bool test_convert_timespec() { - // FIXME add tests for 32 bit builds - return true; - } - - static bool test() { - static_assert(test_timespec(), ""); - static_assert(test_file_time_type(), ""); - static_assert(test_convert_timespec(), ""); - return true; - } -}; - -template <class FileTimeT, class TimeT, class TimeSpec, class Base, - TestKind FileTimeTKind> -struct test_case<FileTimeT, TimeT, TimeSpec, Base, TK_FloatingPoint, - FileTimeTKind> : public Base { - - static bool test() { return true; } -}; - -template <class TimeT, class NSecT = long> -struct TestTimeSpec { - TimeT tv_sec; - NSecT tv_nsec; -}; - -template <class Dur> -struct TestClock { - typedef Dur duration; - typedef typename duration::rep rep; - typedef typename duration::period period; - typedef std::chrono::time_point<TestClock> time_point; - static constexpr const bool is_steady = false; - - static time_point now() noexcept { return {}; } -}; - -template <class IntType, class Period = std::micro> -using TestFileTimeT = time_point<TestClock<duration<IntType, Period> > >; - -int main(int, char**) { - { assert((test_case<file_time_type, time_t, struct timespec>::test())); } - { - assert((test_case<TestFileTimeT<std::int64_t>, std::int64_t, - TestTimeSpec<std::int64_t, long> >::test())); - } - { - assert((test_case<TestFileTimeT<long long>, std::int32_t, - TestTimeSpec<std::int32_t, std::int32_t> >::test())); - } - { - // Test that insane platforms like ppc64 linux, which use long double as time_t, - // at least compile. - assert((test_case<TestFileTimeT<long double>, double, - TestTimeSpec<long double, long> >::test())); - } -#ifndef TEST_HAS_NO_INT128_T - { - assert((test_case<TestFileTimeT<__int128_t, std::nano>, std::int64_t, - TestTimeSpec<std::int64_t, long> >::test())); - } - { - assert((test_case<TestFileTimeT<__int128_t, std::nano>, std::int32_t, - TestTimeSpec<std::int32_t, std::int32_t> >::test())); - } -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp deleted file mode 100644 index 52d8500..0000000 --- a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp +++ /dev/null @@ -1,171 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-filesystem, no-rtti -// UNSUPPORTED: libcpp-has-no-unicode -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// XFAIL: availability-fp_to_chars-missing - -// When std::print is unavailable, we don't rely on an implementation of -// std::__is_terminal and we always assume a non-unicode and non-terminal -// output. -// XFAIL: availability-print-missing - -// Clang modules do not work with the definiton of _LIBCPP_TESTING_PRINT_IS_TERMINAL -// XFAIL: clang-modules-build -// <ostream> - -// Tests the implementation of -// void __vprint_unicode(ostream& os, string_view fmt, -// format_args args, bool write_nl); - -// In the library when std::cout is redirected to a file it is no longer -// considered a terminal and the special terminal handling is no longer -// executed. By testing this function we can "force" emulate a terminal. -// Note write_nl is tested by the public API. - -#include <cstdio> -bool is_terminal(FILE*); -#define _LIBCPP_TESTING_PRINT_IS_TERMINAL ::is_terminal - -#include "filesystem_test_helper.h" -#include <cassert> -#include <fstream> -#include <iostream> -#include <ostream> -#include <sstream> - -#include "test_macros.h" - -scoped_test_env env; -std::string filename = env.create_file("output.txt"); - -int is_terminal_calls = 0; -bool is_terminal_result = false; -bool is_terminal(FILE*) { - ++is_terminal_calls; - return is_terminal_result; -} - -// When the stream is not a file stream, cout, clog, or cerr the stream does not -// considered to be backed by a FILE*. Then the stream should never check -// whether it's a terminal. -static void test_is_terminal_not_a_file_stream() { - is_terminal_calls = 0; - is_terminal_result = false; - { - std::stringstream stream; - std::print(stream, "test"); - } - { - std::ostringstream stream; - std::print(stream, "test"); - } - assert(is_terminal_calls == 0); -} - -// When the stream is a file stream, its FILE* may be a terminal. Validate this -// is tested. -static void test_is_terminal_file_stream() { - is_terminal_calls = 0; - is_terminal_result = false; - { - std::fstream stream(filename); - assert(stream.is_open()); - assert(stream.good()); - std::print(stream, "test"); - assert(is_terminal_calls == 1); - } - { - std::ofstream stream(filename); - assert(stream.is_open()); - assert(stream.good()); - std::print(stream, "test"); - assert(is_terminal_calls == 2); - } -} - -// The same as above, but this time test for derived classes. -static void test_is_terminal_rdbuf_derived_from_filebuf() { - struct my_filebuf : public std::filebuf {}; - - is_terminal_calls = 0; - is_terminal_result = false; - - my_filebuf buf; - buf.open(filename, std::ios_base::out); - assert(buf.is_open()); - - std::ostream stream(&buf); - std::print(stream, "test"); - assert(is_terminal_calls == 1); -} - -// When the stream is cout, clog, or cerr, its FILE* may be a terminal. Validate -// this is tested. -static void test_is_terminal_std_cout_cerr_clog() { - is_terminal_calls = 0; - is_terminal_result = false; - { - std::print(std::cout, "test"); - assert(is_terminal_calls == 1); - } - { - std::print(std::cerr, "test"); - assert(is_terminal_calls == 2); - } - { - std::print(std::clog, "test"); - assert(is_terminal_calls == 3); - } -} - -// When the stream's FILE* is a terminal the contents need to be flushed before -// writing to the stream. -static void test_is_terminal_is_flushed() { - struct sync_counter : public std::filebuf { - sync_counter() { - open(filename, std::ios_base::out); - assert(is_open()); - } - int sync_calls = 0; - - protected: - int virtual sync() { - ++sync_calls; - return std::basic_streambuf<char>::sync(); - } - }; - - is_terminal_result = false; - - sync_counter buf; - std::ostream stream(&buf); - - // Not a terminal sync is not called. - std::print(stream, ""); - assert(buf.sync_calls == 0); - - // A terminal sync is called. - is_terminal_result = true; - std::print(stream, ""); - assert(buf.sync_calls == 1); // only called from the destructor of the sentry -} - -int main(int, char**) { - test_is_terminal_not_a_file_stream(); - test_is_terminal_file_stream(); - test_is_terminal_rdbuf_derived_from_filebuf(); - test_is_terminal_std_cout_cerr_clog(); - - test_is_terminal_is_flushed(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/ostream.syn/includes.compile.pass.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/ostream.syn/includes.compile.pass.cpp deleted file mode 100644 index 7a5bfb992..0000000 --- a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/ostream.syn/includes.compile.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-filesystem -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// XFAIL: availability-fp_to_chars-missing - -// <ostream> - -// The Standard does indirectly require that <ostream> includes <format>. -// However using the granularized headers so it's possible to implement -// <ostream> without <format>. This would be a non-conforming implementation. -// -// See https://github.com/llvm/llvm-project/issues/71925 - -#include <ostream> -#include <vector> - -extern std::ostream& os; - -void test() { - std::vector<int> v{1, 2, 3}; - std::print(os, "{} {}", 42, v); -} diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/transcoding.pass.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/transcoding.pass.cpp deleted file mode 100644 index 225e412..0000000 --- a/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/transcoding.pass.cpp +++ /dev/null @@ -1,91 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-filesystem -// UNSUPPORTED: libcpp-has-no-unicode -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME -// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000 - -// <print> - -// Tests the UTF-8 to UTF-16/32 encoding. -// UTF-16 is used on Windows to write to the Unicode API. -// UTF-32 is used to test the Windows behaviour on Linux using 32-bit wchar_t. - -#include <algorithm> -#include <array> -#include <cassert> -#include <print> -#include <string_view> - -#include "test_macros.h" -#include "make_string.h" - -#define SV(S) MAKE_STRING_VIEW(CharT, S) - -template <class CharT> -constexpr void test(std::basic_string_view<CharT> expected, std::string_view input) { - assert(expected.size() < 1024); - std::array<CharT, 1024> buffer; - std::ranges::fill(buffer, CharT('*')); - - auto out = std::__unicode::__transcode(input.begin(), input.end(), buffer.begin()); - - assert(std::basic_string_view<CharT>(buffer.begin(), out) == expected); - - out = std::find_if(out, buffer.end(), [](CharT c) { return c != CharT('*'); }); - assert(out == buffer.end()); -} - -template <class CharT> -constexpr void test() { - // *** Test valid UTF-8 *** -#define TEST(S) test(SV(S), S) - TEST("hello world"); - // copied from benchmarks/std_format_spec_string_unicode.bench.cpp - TEST("Lorem ipsum dolor sit amet, ne sensibus evertitur aliquando his. Iuvaret fabulas qui ex."); - TEST("Lōrem ipsūm dolor sīt æmeÞ, ea vel nostrud feuġǣit, muciūs tēmporiȝusrefērrēnÞur no mel."); - TEST("Лорем ипсум долор сит амет, еу диам тамяуам принципес вис, еяуидем цонцептам диспутандо"); - TEST("入ト年媛ろ舗学ラロ準募ケカ社金スノ屋検れう策他セヲシ引口ぎ集7独ぱクふ出車ぽでぱ円輪ルノ受打わ。"); - TEST("\U0001f636\u200d\U0001f32b\ufe0f"); -#undef TEST - - // *** Test invalid UTF-8 *** - test(SV("\ufffd"), "\xc3"); - test(SV("\ufffd("), "\xc3\x28"); - - // Surrogate range - test(SV("\ufffd"), "\xed\xa0\x80"); // U+D800 - test(SV("\ufffd"), "\xed\xaf\xbf"); // U+DBFF - test(SV("\ufffd"), "\xed\xbf\x80"); // U+DC00 - test(SV("\ufffd"), "\xed\xbf\xbf"); // U+DFFF - - // Beyond valid values - test(SV("\ufffd"), "\xf4\x90\x80\x80"); // U+110000 - test(SV("\ufffd"), "\xf4\xbf\xbf\xbf"); // U+11FFFF - - // Validates http://unicode.org/review/pr-121.html option 3. - test(SV("\u0061\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0062"), "\x61\xF1\x80\x80\xE1\x80\xC2\x62"); -} - -constexpr bool test() { - test<char16_t>(); - test<char32_t>(); -#if !defined(TEST_HAS_NO_WIDE_CHARACTERS) - test<wchar_t>(); -#endif - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp deleted file mode 100644 index b89d02b..0000000 --- a/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-filesystem -// UNSUPPORTED: libcpp-has-no-unicode -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// XFAIL: availability-fp_to_chars-missing - -// fmemopen is available starting in Android M (API 23) -// XFAIL: target={{.+}}-android{{(eabi)?(21|22)}} - -// REQUIRES: has-unix-headers - -// <print> - -// Tests the implementation of -// void __print::__vprint_unicode_posix(FILE* __stream, string_view __fmt, -// format_args __args, bool __write_nl, -// bool __is_terminal); -// -// In the library when the stdout is redirected to a file it is no -// longer considered a terminal and the special terminal handling is no -// longer executed. By testing this function we can "force" emulate a -// terminal. -// Note __write_nl is tested by the public API. - -#include <algorithm> -#include <array> -#include <cassert> -#include <cstdio> -#include <print> - -#include "test_macros.h" - -int main(int, char**) { - std::array<char, 100> buffer; - std::ranges::fill(buffer, '*'); - - FILE* file = fmemopen(buffer.data(), buffer.size(), "wb"); - assert(file); - - // Test the file is buffered. - std::fprintf(file, "Hello"); - assert(std::ftell(file) == 5); -#if defined(TEST_HAS_GLIBC) && \ - !(__has_feature(address_sanitizer) || __has_feature(thread_sanitizer) || __has_feature(memory_sanitizer)) - assert(std::ranges::all_of(buffer, [](char c) { return c == '*'; })); -#endif - - // Test writing to a "non-terminal" stream does not flush. - std::__print::__vprint_unicode_posix(file, " world", std::make_format_args(), false, false); - assert(std::ftell(file) == 11); -#if defined(TEST_HAS_GLIBC) && \ - !(__has_feature(address_sanitizer) || __has_feature(thread_sanitizer) || __has_feature(memory_sanitizer)) - assert(std::ranges::all_of(buffer, [](char c) { return c == '*'; })); -#endif - - // Test writing to a "terminal" stream flushes before writing. - std::__print::__vprint_unicode_posix(file, "!", std::make_format_args(), false, true); - assert(std::ftell(file) == 12); - assert(std::string_view(buffer.data(), buffer.data() + 11) == "Hello world"); -#if defined(TEST_HAS_GLIBC) - // glibc does not flush after a write. - assert(buffer[11] != '!'); -#endif - - // Test everything is written when closing the stream. - std::fclose(file); - assert(std::string_view(buffer.data(), buffer.data() + 12) == "Hello world!"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp deleted file mode 100644 index bcd1d05..0000000 --- a/libcxx/test/libcxx-03/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp +++ /dev/null @@ -1,135 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-filesystem -// UNSUPPORTED: no-wide-characters -// UNSUPPORTED: libcpp-has-no-unicode -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// Clang modules do not work with the definiton of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION -// XFAIL: clang-modules-build - -// XFAIL: availability-fp_to_chars-missing - -// <print> - -// Tests the implementation of -// void __print::__vprint_unicode_windows(FILE* __stream, string_view __fmt, -// format_args __args, bool __write_nl, -// bool __is_terminal); -// -// In the library when the stdout is redirected to a file it is no -// longer considered a terminal and the special terminal handling is no -// longer executed. By testing this function we can "force" emulate a -// terminal. -// Note __write_nl is tested by the public API. - -#include <string_view> -#include <cstdio> -#include <algorithm> -#include <cassert> - -void write_to_console(FILE*, std::wstring_view data); -#define _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION ::write_to_console -#include <print> - -#include "test_macros.h" -#include "filesystem_test_helper.h" -#include "make_string.h" - -TEST_GCC_DIAGNOSTIC_IGNORED("-Wuse-after-free") - -#define SV(S) MAKE_STRING_VIEW(wchar_t, S) - -bool calling = false; -std::wstring_view expected = L" world"; - -void write_to_console(FILE*, std::wstring_view data) { - assert(calling); - assert(data == expected); -} - -scoped_test_env env; -std::string filename = env.create_file("output.txt"); - -static void test_basics() { - FILE* file = std::fopen(filename.c_str(), "wb"); - assert(file); - - // Test writing to a "non-terminal" stream does not call WriteConsoleW. - std::__print::__vprint_unicode_windows(file, "Hello", std::make_format_args(), false, false); - assert(std::ftell(file) == 5); - - // It's not possible to reliably test whether writing to a "terminal" stream - // flushes before writing. Testing flushing a closed stream worked on some - // platforms, but was unreliable. - calling = true; - std::__print::__vprint_unicode_windows(file, " world", std::make_format_args(), false, true); -} - -// When the output is a file the data is written as-is. -// When the output is a "terminal" invalid UTF-8 input is flagged. -static void test(std::wstring_view output, std::string_view input) { - // *** File *** - FILE* file = std::fopen(filename.c_str(), "wb"); - assert(file); - - std::__print::__vprint_unicode_windows(file, input, std::make_format_args(), false, false); - assert(std::ftell(file) == static_cast<long>(input.size())); - std::fclose(file); - - file = std::fopen(filename.c_str(), "rb"); - assert(file); - - std::vector<char> buffer(input.size()); - size_t read = fread(buffer.data(), 1, buffer.size(), file); - assert(read == input.size()); - assert(input == std::string_view(buffer.begin(), buffer.end())); - std::fclose(file); - - // *** Terminal *** - expected = output; - std::__print::__vprint_unicode_windows(file, input, std::make_format_args(), false, true); -} - -static void test() { - // *** Test valid UTF-8 *** -#define TEST(S) test(SV(S), S) - TEST("hello world"); - - // copied from benchmarks/std_format_spec_string_unicode.bench.cpp - TEST("Lorem ipsum dolor sit amet, ne sensibus evertitur aliquando his. Iuvaret fabulas qui ex."); - TEST("Lōrem ipsūm dolor sīt æmeÞ, ea vel nostrud feuġǣit, muciūs tēmporiȝusrefērrēnÞur no mel."); - TEST("Лорем ипсум долор сит амет, еу диам тамяуам принципес вис, еяуидем цонцептам диспутандо"); - TEST("入ト年媛ろ舗学ラロ準募ケカ社金スノ屋検れう策他セヲシ引口ぎ集7独ぱクふ出車ぽでぱ円輪ルノ受打わ。"); - TEST("\U0001f636\u200d\U0001f32b\ufe0f"); -#undef TEST - - // *** Test invalid utf-8 *** - test(SV("\ufffd"), "\xc3"); - test(SV("\ufffd("), "\xc3\x28"); - - // surrogate range - test(SV("\ufffd"), "\xed\xa0\x80"); // U+D800 - test(SV("\ufffd"), "\xed\xaf\xbf"); // U+DBFF - test(SV("\ufffd"), "\xed\xbf\x80"); // U+DC00 - test(SV("\ufffd"), "\xed\xbf\xbf"); // U+DFFF - - // beyond valid values - test(SV("\ufffd"), "\xf4\x90\x80\x80"); // U+110000 - test(SV("\ufffd"), "\xf4\xbf\xbf\xbf"); // U+11FFFF - - // Validates http://unicode.org/review/pr-121.html option 3. - test(SV("\u0061\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0062"), "\x61\xf1\x80\x80\xe1\x80\xc2\x62"); -} - -int main(int, char**) { - test_basics(); - test(); -} diff --git a/libcxx/test/libcxx-03/iterators/assert.advance.pass.cpp b/libcxx/test/libcxx-03/iterators/assert.advance.pass.cpp deleted file mode 100644 index a7e8878..0000000 --- a/libcxx/test/libcxx-03/iterators/assert.advance.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <list> - -// Call advance(non-bidi iterator, -1) - -#include <iterator> - -#include "check_assertion.h" -#include "test_iterators.h" - -int main(int, char**) { - int a[] = {1, 2, 3}; - - bidirectional_iterator<int *> bidi(a+1); - std::advance(bidi, 1); // should work fine - std::advance(bidi, 0); // should work fine - std::advance(bidi, -1); // should work fine - - forward_iterator<int *> it(a+1); - std::advance(it, 1); // should work fine - std::advance(it, 0); // should work fine - TEST_LIBCPP_ASSERT_FAILURE(std::advance(it, -1), "std::advance: Can only pass a negative `n` with a bidirectional_iterator."); - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/assert.next.pass.cpp b/libcxx/test/libcxx-03/iterators/assert.next.pass.cpp deleted file mode 100644 index 2e0296b..0000000 --- a/libcxx/test/libcxx-03/iterators/assert.next.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <list> - -// Call next(non-bidi iterator, -1) - -#include <iterator> - -#include "check_assertion.h" -#include "test_iterators.h" - -int main(int, char**) { - int a[] = {1, 2, 3}; - forward_iterator<int *> it(a+1); - (void)std::next(it, 1); // should work fine - (void)std::next(it, 0); // should work fine - TEST_LIBCPP_ASSERT_FAILURE(std::next(it, -1), "std::advance: Can only pass a negative `n` with a bidirectional_iterator."); - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/assert.prev.pass.cpp b/libcxx/test/libcxx-03/iterators/assert.prev.pass.cpp deleted file mode 100644 index deac1ed..0000000 --- a/libcxx/test/libcxx-03/iterators/assert.prev.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <list> - -// Call prev(forward_iterator, -1) - -#include <iterator> - -#include "check_assertion.h" -#include "test_iterators.h" - -int main(int, char**) { - int a[] = {1, 2, 3}; - - bidirectional_iterator<int *> bidi(a+1); - (void)std::prev(bidi, -1); // should work fine - (void)std::prev(bidi, 0); // should work fine - (void)std::prev(bidi, 1); // should work fine - - forward_iterator<int *> it(a+1); - (void)std::prev(it, -1); // should work fine - (void)std::prev(it, 0); // should work fine - TEST_LIBCPP_ASSERT_FAILURE(std::prev(it, 1), "std::advance: Can only pass a negative `n` with a bidirectional_iterator."); - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/dereference.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/dereference.pass.cpp deleted file mode 100644 index 7e3a59a..0000000 --- a/libcxx/test/libcxx-03/iterators/bounded_iter/dereference.pass.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// template <class _Iterator> -// struct __bounded_iter; -// -// Dereference and indexing operators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <__iterator/bounded_iter.h> - -#include "check_assertion.h" -#include "test_iterators.h" -#include "test_macros.h" - -struct Foo { - int x; - TEST_CONSTEXPR bool operator==(Foo const& other) const { return x == other.x; } -}; - -template <class Iter> -TEST_CONSTEXPR_CXX14 bool tests() { - Foo array[] = {Foo{40}, Foo{41}, Foo{42}, Foo{43}, Foo{44}}; - Foo* b = array + 0; - Foo* e = array + 5; - std::__bounded_iter<Iter> const iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); - std::__bounded_iter<Iter> const iter2 = std::__make_bounded_iter(Iter(e), Iter(b), Iter(e)); - - // operator* - assert(*iter1 == Foo{40}); - // operator-> - assert(iter1->x == 40); - // operator[] - assert(iter1[0] == Foo{40}); - assert(iter1[1] == Foo{41}); - assert(iter1[2] == Foo{42}); - assert(iter2[-1] == Foo{44}); - assert(iter2[-2] == Foo{43}); - - return true; -} - -template <class Iter> -void test_death() { - Foo array[] = {Foo{0}, Foo{1}, Foo{2}, Foo{3}, Foo{4}}; - Foo* b = array + 0; - Foo* e = array + 5; - std::__bounded_iter<Iter> const iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); - std::__bounded_iter<Iter> const oob = std::__make_bounded_iter(Iter(e), Iter(b), Iter(e)); - - // operator* - TEST_LIBCPP_ASSERT_FAILURE(*oob, "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); - // operator-> - TEST_LIBCPP_ASSERT_FAILURE(oob->x, "__bounded_iter::operator->: Attempt to dereference an iterator at the end"); - // operator[] - TEST_LIBCPP_ASSERT_FAILURE(iter[-1], "__bounded_iter::operator[]: Attempt to index an iterator past the start"); - TEST_LIBCPP_ASSERT_FAILURE(iter[5], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - TEST_LIBCPP_ASSERT_FAILURE(oob[0], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - TEST_LIBCPP_ASSERT_FAILURE(oob[1], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - TEST_LIBCPP_ASSERT_FAILURE(oob[-6], "__bounded_iter::operator[]: Attempt to index an iterator past the start"); -} - -int main(int, char**) { - tests<Foo*>(); - test_death<Foo*>(); -#if TEST_STD_VER > 11 - static_assert(tests<Foo*>(), ""); -#endif - -#if TEST_STD_VER > 17 - tests<contiguous_iterator<Foo*> >(); - test_death<contiguous_iterator<Foo*> >(); - static_assert(tests<contiguous_iterator<Foo*> >(), ""); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/iterator.concepts/iterator.concept.random.access/subsumption.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.concepts/iterator.concept.random.access/subsumption.compile.pass.cpp deleted file mode 100644 index 601f60b..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.concepts/iterator.concept.random.access/subsumption.compile.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class T> -// concept random_access_iterator; - -#include <iterator> - -#include <concepts> - -template<std::bidirectional_iterator I> -requires std::derived_from<std::_ITER_CONCEPT<I>, std::random_access_iterator_tag> -constexpr bool check_subsumption() { - return false; -} - -template<std::random_access_iterator> -constexpr bool check_subsumption() { - return true; -} - -static_assert(check_subsumption<int*>()); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_bidirectional_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_bidirectional_iterator.compile.pass.cpp deleted file mode 100644 index e8b5a0c..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_bidirectional_iterator.compile.pass.cpp +++ /dev/null @@ -1,164 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// This test uses iterator types from std::filesystem -// XFAIL: availability-filesystem-missing - -// template<class I> -// concept __iterator_traits_detail::__cpp17_bidirectional_iterator; - -#include "test_macros.h" - -#include <iterator> - -#include <array> -#include <deque> -#ifndef TEST_HAS_NO_FILESYSTEM -#include <filesystem> -#endif -#include <forward_list> -#include <list> -#include <map> -#include <set> -#include <string> -#include <string_view> -#include <unordered_map> -#include <unordered_set> -#include <vector> - -#include "iterator_traits_cpp17_iterators.h" - -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_proxy_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_input_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_proxy_input_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_forward_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_bidirectional_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<iterator_traits_cpp17_random_access_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int*>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int const*>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int volatile*>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int const volatile*>); - -// <array> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::array<int, 10>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::array<int, 10>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::array<int, 10>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::array<int, 10>::const_reverse_iterator>); - -// <deque> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::deque<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::deque<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::deque<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::deque<int>::const_reverse_iterator>); - -// <filesystem> -#ifndef TEST_HAS_NO_FILESYSTEM -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::filesystem::directory_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::filesystem::recursive_directory_iterator>); -#endif - -// <forward_list> -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::forward_list<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::forward_list<int>::const_iterator>); - -// <iterator> -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::back_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::front_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::move_iterator<int*>>); - -// <list> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::list<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::list<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::list<int>::const_reverse_iterator>); - -// <map> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::map<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::map<int, int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multimap<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multimap<int, int>::const_reverse_iterator>); - -// <set> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::set<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::set<int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multiset<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::multiset<int>::const_reverse_iterator>); - -// <string> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string::const_reverse_iterator>); - -// <string_view> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string_view::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string_view::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string_view::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::string_view::const_reverse_iterator>); - -// <unordered_map> -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_map<int, int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_map<int, int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_map<int, int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_map<int, int>::const_local_iterator>); - -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multimap<int, int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multimap<int, int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multimap<int, int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multimap<int, int>::const_local_iterator>); - -// <unordered_set> -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_set<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_set<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_set<int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_set<int>::const_local_iterator>); - -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multiset<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multiset<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multiset<int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::unordered_multiset<int>::const_local_iterator>); - -// <vector> -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::const_reverse_iterator>); - -// Not iterators -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<void>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<void*>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int* const>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::iterator volatile>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::iterator&>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::vector<int>::iterator&&>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int[]>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int[10]>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int()>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int (*)()>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int (&)()>); - -struct S {}; -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<S>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int S::*>); -static_assert(!std::__iterator_traits_detail::__cpp17_bidirectional_iterator<int (S::*)()>); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_forward_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_forward_iterator.compile.pass.cpp deleted file mode 100644 index 9e36cfa..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_forward_iterator.compile.pass.cpp +++ /dev/null @@ -1,164 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// This test uses iterator types from std::filesystem -// XFAIL: availability-filesystem-missing - -// template<class I> -// concept __iterator_traits_detail::__cpp17_forward_iterator; - -#include "test_macros.h" - -#include <iterator> - -#include <array> -#include <deque> -#ifndef TEST_HAS_NO_FILESYSTEM -#include <filesystem> -#endif -#include <forward_list> -#include <list> -#include <map> -#include <set> -#include <string> -#include <string_view> -#include <unordered_map> -#include <unordered_set> -#include <vector> - -#include "iterator_traits_cpp17_iterators.h" - -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_proxy_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_input_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_proxy_input_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_forward_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_bidirectional_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<iterator_traits_cpp17_random_access_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<int*>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<int const*>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<int volatile*>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<int const volatile*>); - -// <array> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::array<int, 10>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::array<int, 10>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::array<int, 10>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::array<int, 10>::const_reverse_iterator>); - -// <deque> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::deque<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::deque<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::deque<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::deque<int>::const_reverse_iterator>); - -// <filesystem> -#ifndef TEST_HAS_NO_FILESYSTEM -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::filesystem::directory_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::filesystem::recursive_directory_iterator>); -#endif - -// <forward_list> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::forward_list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::forward_list<int>::const_iterator>); - -// <iterator> -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::back_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::front_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::move_iterator<int*>>); - -// <list> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::list<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::list<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::list<int>::const_reverse_iterator>); - -// <map> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::map<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::map<int, int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multimap<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multimap<int, int>::const_reverse_iterator>); - -// <set> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::set<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::set<int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multiset<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::multiset<int>::const_reverse_iterator>); - -// <string> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string::const_reverse_iterator>); - -// <string_view> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string_view::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string_view::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string_view::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::string_view::const_reverse_iterator>); - -// <unordered_map> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_map<int, int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_map<int, int>::const_local_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multimap<int, int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multimap<int, int>::const_local_iterator>); - -// <unordered_set> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_set<int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_set<int>::const_local_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multiset<int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::unordered_multiset<int>::const_local_iterator>); - -// <vector> -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::const_reverse_iterator>); - -// Not iterators -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<void>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<void*>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int* const>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::iterator volatile>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::iterator&>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::vector<int>::iterator&&>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int[]>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int[10]>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int()>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int (*)()>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int (&)()>); - -struct S {}; -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<S>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int S::*>); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<int (S::*)()>); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_input_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_input_iterator.compile.pass.cpp deleted file mode 100644 index 69a6391..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_input_iterator.compile.pass.cpp +++ /dev/null @@ -1,164 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// This test uses iterator types from std::filesystem -// XFAIL: availability-filesystem-missing - -// template<class I> -// concept __iterator_traits_detail::__cpp17_input_iterator; - -#include "test_macros.h" - -#include <iterator> - -#include <array> -#include <deque> -#ifndef TEST_HAS_NO_FILESYSTEM -#include <filesystem> -#endif -#include <forward_list> -#include <list> -#include <map> -#include <set> -#include <string> -#include <string_view> -#include <unordered_map> -#include <unordered_set> -#include <vector> - -#include "iterator_traits_cpp17_iterators.h" - -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_proxy_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_input_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_proxy_input_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_forward_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_bidirectional_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<iterator_traits_cpp17_random_access_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<int*>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<int const*>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<int volatile*>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<int const volatile*>); - -// <array> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::array<int, 10>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::array<int, 10>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::array<int, 10>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::array<int, 10>::const_reverse_iterator>); - -// <deque> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::deque<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::deque<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::deque<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::deque<int>::const_reverse_iterator>); - -// <filesystem> -#ifndef TEST_HAS_NO_FILESYSTEM -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::filesystem::directory_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::filesystem::recursive_directory_iterator>); -#endif - -// <forward_list> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::forward_list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::forward_list<int>::const_iterator>); - -// <iterator> -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::back_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::front_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::move_iterator<int*>>); - -// <list> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::list<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::list<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::list<int>::const_reverse_iterator>); - -// <map> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::map<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::map<int, int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multimap<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multimap<int, int>::const_reverse_iterator>); - -// <set> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::set<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::set<int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multiset<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::multiset<int>::const_reverse_iterator>); - -// <string> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string::const_reverse_iterator>); - -// <string_view> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string_view::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string_view::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string_view::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::string_view::const_reverse_iterator>); - -// <unordered_map> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_map<int, int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_map<int, int>::const_local_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multimap<int, int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multimap<int, int>::const_local_iterator>); - -// <unordered_set> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_set<int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_set<int>::const_local_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multiset<int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::unordered_multiset<int>::const_local_iterator>); - -// <vector> -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::const_reverse_iterator>); - -// Not iterators -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<void>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<void*>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int* const>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::iterator volatile>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::iterator&>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::vector<int>::iterator&&>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int[]>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int[10]>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int()>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int (*)()>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int (&)()>); - -struct S {}; -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<S>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int S::*>); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<int (S::*)()>); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_iterator.compile.pass.cpp deleted file mode 100644 index 54e9d7b..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_iterator.compile.pass.cpp +++ /dev/null @@ -1,164 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// This test uses iterator types from std::filesystem -// XFAIL: availability-filesystem-missing - -// template<class I> -// concept __iterator_traits_detail::__cpp17_iterator; - -#include "test_macros.h" - -#include <iterator> - -#include <array> -#include <deque> -#ifndef TEST_HAS_NO_FILESYSTEM -#include <filesystem> -#endif -#include <forward_list> -#include <list> -#include <map> -#include <set> -#include <string> -#include <string_view> -#include <unordered_map> -#include <unordered_set> -#include <vector> - -#include "iterator_traits_cpp17_iterators.h" - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_proxy_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_input_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_proxy_input_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_forward_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_bidirectional_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<iterator_traits_cpp17_random_access_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<int*>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<int const*>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<int volatile*>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<int const volatile*>); - -// <array> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::array<int, 10>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::array<int, 10>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::array<int, 10>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::array<int, 10>::const_reverse_iterator>); - -// <deque> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::deque<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::deque<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::deque<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::deque<int>::const_reverse_iterator>); - -// <filesystem> -#ifndef TEST_HAS_NO_FILESYSTEM -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::filesystem::directory_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::filesystem::recursive_directory_iterator>); -#endif - -// <forward_list> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::forward_list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::forward_list<int>::const_iterator>); - -// <iterator> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::back_insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::front_insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::move_iterator<int*>>); - -// <list> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::list<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::list<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::list<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::list<int>::const_reverse_iterator>); - -// <map> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::map<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::map<int, int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multimap<int, int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multimap<int, int>::const_reverse_iterator>); - -// <set> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::set<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::set<int>::const_reverse_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multiset<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::multiset<int>::const_reverse_iterator>); - -// <string> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string::const_reverse_iterator>); - -// <string_view> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string_view::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string_view::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string_view::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::string_view::const_reverse_iterator>); - -// <unordered_map> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_map<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_map<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_map<int, int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_map<int, int>::const_local_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multimap<int, int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multimap<int, int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multimap<int, int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multimap<int, int>::const_local_iterator>); - -// <unordered_set> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_set<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_set<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_set<int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_set<int>::const_local_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multiset<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multiset<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multiset<int>::local_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::unordered_multiset<int>::const_local_iterator>); - -// <vector> -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::const_reverse_iterator>); - -// Not iterators -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<void>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<void*>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int* const>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::iterator volatile>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::iterator&>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<std::vector<int>::iterator&&>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int[]>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int[10]>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int()>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int (*)()>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int (&)()>); - -struct S {}; -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<S>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int S::*>); -static_assert(!std::__iterator_traits_detail::__cpp17_iterator<int (S::*)()>); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_random_access_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_random_access_iterator.compile.pass.cpp deleted file mode 100644 index 0532151..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/legacy_random_access_iterator.compile.pass.cpp +++ /dev/null @@ -1,164 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// This test uses iterator types from std::filesystem -// XFAIL: availability-filesystem-missing - -// template<class I> -// concept __iterator_traits_detail::__cpp17_random_access_iterator; - -#include "test_macros.h" - -#include <iterator> - -#include <array> -#include <deque> -#ifndef TEST_HAS_NO_FILESYSTEM -#include <filesystem> -#endif -#include <forward_list> -#include <list> -#include <map> -#include <set> -#include <string> -#include <string_view> -#include <unordered_map> -#include <unordered_set> -#include <vector> - -#include "iterator_traits_cpp17_iterators.h" - -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_proxy_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_input_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_proxy_input_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_forward_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_bidirectional_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<iterator_traits_cpp17_random_access_iterator>); - -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<int*>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<int const*>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<int volatile*>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<int const volatile*>); - -// <array> -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::array<int, 10>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::array<int, 10>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::array<int, 10>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::array<int, 10>::const_reverse_iterator>); - -// <deque> -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::deque<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::deque<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::deque<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::deque<int>::const_reverse_iterator>); - -// <filesystem> -#ifndef TEST_HAS_NO_FILESYSTEM -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::filesystem::directory_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::filesystem::recursive_directory_iterator>); -#endif - -// <forward_list> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::forward_list<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::forward_list<int>::const_iterator>); - -// <iterator> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::back_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::front_insert_iterator<std::vector<int>>>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::insert_iterator<std::vector<int>>>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::move_iterator<int*>>); - -// <list> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::list<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::list<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::list<int>::reverse_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::list<int>::const_reverse_iterator>); - -// <map> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::map<int, int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::map<int, int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::map<int, int>::reverse_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::map<int, int>::const_reverse_iterator>); - -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multimap<int, int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multimap<int, int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multimap<int, int>::reverse_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multimap<int, int>::const_reverse_iterator>); - -// <set> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::set<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::set<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::set<int>::reverse_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::set<int>::const_reverse_iterator>); - -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multiset<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multiset<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multiset<int>::reverse_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::multiset<int>::const_reverse_iterator>); - -// <string> -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string::const_reverse_iterator>); - -// <string_view> -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string_view::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string_view::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string_view::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::string_view::const_reverse_iterator>); - -// <unordered_map> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_map<int, int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_map<int, int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_map<int, int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_map<int, int>::const_local_iterator>); - -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multimap<int, int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multimap<int, int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multimap<int, int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multimap<int, int>::const_local_iterator>); - -// <unordered_set> -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_set<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_set<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_set<int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_set<int>::const_local_iterator>); - -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multiset<int>::iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multiset<int>::const_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multiset<int>::local_iterator>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::unordered_multiset<int>::const_local_iterator>); - -// <vector> -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::const_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::reverse_iterator>); -static_assert(std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::const_reverse_iterator>); - -// Not iterators -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<void>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<void*>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int* const>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::iterator volatile>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::iterator&>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<std::vector<int>::iterator&&>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int[]>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int[10]>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int()>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int (*)()>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int (&)()>); - -struct S {}; -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<S>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int S::*>); -static_assert(!std::__iterator_traits_detail::__cpp17_random_access_iterator<int (S::*)()>); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/locale_dependent.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/locale_dependent.compile.pass.cpp deleted file mode 100644 index 683a2dc..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.assoc.types/iterator.traits/locale_dependent.compile.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-localization - -#include <iterator> - -#include <istream> -#include <ostream> - -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::istream_iterator<int, std::istream> >); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::istreambuf_iterator<int, std::istream> >); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::ostream_iterator<int, std::ostream> >); -static_assert(std::__iterator_traits_detail::__cpp17_iterator<std::ostreambuf_iterator<int, std::ostream> >); - -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::istream_iterator<int, std::istream> >); -static_assert(std::__iterator_traits_detail::__cpp17_input_iterator<std::istreambuf_iterator<int, std::istream> >); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::ostream_iterator<int, std::ostream> >); -static_assert(!std::__iterator_traits_detail::__cpp17_input_iterator<std::ostreambuf_iterator<int, std::ostream> >); - -// This is because the legacy iterator concepts don't care about iterator_category -static_assert(std::__iterator_traits_detail::__cpp17_forward_iterator<std::istream_iterator<int, std::istream> >); - -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::istreambuf_iterator<int, std::istream> >); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::ostream_iterator<int, std::ostream> >); -static_assert(!std::__iterator_traits_detail::__cpp17_forward_iterator<std::ostreambuf_iterator<int, std::ostream> >); - -static_assert( - !std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::istream_iterator<int, std::istream> >); -static_assert( - !std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::istreambuf_iterator<int, std::istream> >); -static_assert( - !std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::ostream_iterator<int, std::ostream> >); -static_assert( - !std::__iterator_traits_detail::__cpp17_bidirectional_iterator<std::ostreambuf_iterator<int, std::ostream> >); - -static_assert( - !std::__iterator_traits_detail::__cpp17_random_access_iterator<std::istream_iterator<int, std::istream> >); -static_assert( - !std::__iterator_traits_detail::__cpp17_random_access_iterator<std::istreambuf_iterator<int, std::istream> >); -static_assert( - !std::__iterator_traits_detail::__cpp17_random_access_iterator<std::ostream_iterator<int, std::ostream> >); -static_assert( - !std::__iterator_traits_detail::__cpp17_random_access_iterator<std::ostreambuf_iterator<int, std::ostream> >); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/cpp20_iter_concepts.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/cpp20_iter_concepts.compile.pass.cpp deleted file mode 100644 index ffe473c..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/cpp20_iter_concepts.compile.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 - -// ITER_TRAITS(I) - -// -- If the qualified-id ITER_TRAITS(I)::iterator_concept is valid and names a -// type, then ITER_CONCEPT(I) denotes that type. -// (1.2) -- Otherwise, if the qualified-id ITER_TRAITS(I)::iterator_category is -// valid and names a type, then ITER_CONCEPT(I) denotes that type. -// (1.3) -- Otherwise, if iterator_traits<I> names a specialization generated -// from the primary template, then ITER_CONCEPT(I) denotes -// random_access_iterator_tag. -// (1.4) -- Otherwise, ITER_CONCEPT(I) does not denote a type. - -#include <__iterator/concepts.h> -#include <__type_traits/is_valid_expansion.h> -#include <cstddef> -#include <iterator> - -#include "test_macros.h" - -struct OtherTag : std::input_iterator_tag {}; -struct OtherTagTwo : std::output_iterator_tag {}; - -struct MyIter { - using iterator_category = std::random_access_iterator_tag; - using iterator_concept = int; - using value_type = char; - using difference_type = std::ptrdiff_t; - using pointer = char*; - using reference = char&; -}; - -struct MyIter2 { - using iterator_category = OtherTag; - using value_type = char; - using difference_type = std::ptrdiff_t; - using pointer = char*; - using reference = char&; -}; - -struct MyIter3 {}; - -struct Empty {}; -struct EmptyWithSpecial {}; -template <> -struct std::iterator_traits<MyIter3> { - using iterator_category = OtherTagTwo; - using value_type = char; - using difference_type = std::ptrdiff_t; - using pointer = char*; - using reference = char&; -}; - -template <> -struct std::iterator_traits<EmptyWithSpecial> { - // empty non-default. -}; - -// If the qualified-id ITER_TRAITS(I)::iterator_concept is valid and names a type, -// then ITER_CONCEPT(I) denotes that type. -ASSERT_SAME_TYPE(std::_ITER_CONCEPT<char*>, std::contiguous_iterator_tag); -ASSERT_SAME_TYPE(std::_ITER_CONCEPT<MyIter>, int); - -// Otherwise, if the qualified-id ITER_TRAITS(I)::iterator_category is valid -// and names a type, then ITER_CONCEPT(I) denotes that type. -ASSERT_SAME_TYPE(std::_ITER_CONCEPT<MyIter2>, OtherTag); -ASSERT_SAME_TYPE(std::_ITER_CONCEPT<MyIter3>, OtherTagTwo); - -// FIXME - This requirement makes no sense to me. Why does an empty type with -// an empty default iterator_traits get a category of random? -ASSERT_SAME_TYPE(std::_ITER_CONCEPT<Empty>, std::random_access_iterator_tag); - -static_assert(!std::_IsValidExpansion<std::_ITER_CONCEPT, EmptyWithSpecial>::value); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/cpp20_iter_traits.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/cpp20_iter_traits.compile.pass.cpp deleted file mode 100644 index 066587d..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/cpp20_iter_traits.compile.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 - -// ITER_TRAITS(I) - -// For a type I, let ITER_TRAITS(I) denote the type I if iterator_traits<I> names -// a specialization generated from the primary template. Otherwise, -// ITER_TRAITS(I) denotes iterator_traits<I>. - -#include <__iterator/concepts.h> -#include <type_traits> - -#include "test_iterators.h" - -struct A : random_access_iterator<int*> {}; -struct B : random_access_iterator<int*> {}; -struct C : random_access_iterator<int*> {}; -struct D : random_access_iterator<int*> {}; -template<> struct std::iterator_traits<B> {}; -template<> struct std::iterator_traits<C> : std::iterator_traits<A> {}; -template<> struct std::iterator_traits<D> : std::iterator_traits<int*> {}; - -static_assert(std::is_same<std::_ITER_TRAITS<int*>, std::iterator_traits<int*>>::value); -static_assert(std::is_same<std::_ITER_TRAITS<A>, A>::value); -static_assert(std::is_same<std::_ITER_TRAITS<B>, std::iterator_traits<B>>::value); -static_assert(std::is_same<std::_ITER_TRAITS<C>, std::iterator_traits<C>>::value); -static_assert(std::is_same<std::_ITER_TRAITS<D>, std::iterator_traits<D>>::value); diff --git a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/integer_like.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/integer_like.compile.pass.cpp deleted file mode 100644 index 91b3acf..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator.requirements/iterator.concepts/integer_like.compile.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <iterator> - -#include <concepts> - -static_assert(!std::__integer_like<bool>); -static_assert(std::__integer_like<signed char>); -static_assert(std::__integer_like<unsigned char>); -static_assert(std::__integer_like<short>); -static_assert(std::__integer_like<unsigned short>); -static_assert(std::__integer_like<int>); -static_assert(std::__integer_like<unsigned int>); -static_assert(std::__integer_like<long>); -static_assert(std::__integer_like<unsigned long>); -static_assert(std::__integer_like<long long>); -static_assert(std::__integer_like<unsigned long long>); -static_assert(std::__integer_like<char>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(std::__integer_like<wchar_t>); -#endif -static_assert(std::__integer_like<char8_t>); -static_assert(std::__integer_like<char16_t>); -static_assert(std::__integer_like<char32_t>); - -static_assert(!std::__signed_integer_like<bool>); -static_assert(std::__signed_integer_like<signed char>); -static_assert(std::__signed_integer_like<short>); -static_assert(std::__signed_integer_like<int>); -static_assert(std::__signed_integer_like<long>); -static_assert(std::__signed_integer_like<long long>); -static_assert(!std::__signed_integer_like<unsigned char>); -static_assert(!std::__signed_integer_like<unsigned short>); -static_assert(!std::__signed_integer_like<unsigned int>); -static_assert(!std::__signed_integer_like<unsigned long>); -static_assert(!std::__signed_integer_like<unsigned long long>); -static_assert(std::__signed_integer_like<char> == std::signed_integral<char>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(std::__signed_integer_like<wchar_t> == std::signed_integral<wchar_t>); -#endif -static_assert(std::__signed_integer_like<char8_t> == std::signed_integral<char8_t>); -static_assert(std::__signed_integer_like<char16_t> == std::signed_integral<char16_t>); -static_assert(std::__signed_integer_like<char32_t> == std::signed_integral<char32_t>); diff --git a/libcxx/test/libcxx-03/iterators/iterator_with_data.pass.cpp b/libcxx/test/libcxx-03/iterators/iterator_with_data.pass.cpp deleted file mode 100644 index b2e3ffe..0000000 --- a/libcxx/test/libcxx-03/iterators/iterator_with_data.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include "test_macros.h" - -TEST_DIAGNOSTIC_PUSH -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") -#include <__iterator/iterator_with_data.h> -TEST_DIAGNOSTIC_POP - -#include "test_iterators.h" - -static_assert(std::forward_iterator<std::__iterator_with_data<forward_iterator<int*>, int>>); -static_assert(std::bidirectional_iterator<std::__iterator_with_data<bidirectional_iterator<int*>, int>>); -static_assert(std::bidirectional_iterator<std::__iterator_with_data<random_access_iterator<int*>, int>>); -static_assert(std::bidirectional_iterator<std::__iterator_with_data<contiguous_iterator<int*>, int>>); - -constexpr bool test() { - { - std::__iterator_with_data<forward_iterator<int*>, int> iter(forward_iterator<int*>(nullptr), 3); - assert(iter == iter); - assert(iter.__get_iter() == forward_iterator<int*>(nullptr)); - assert(std::move(iter).__get_data() == 3); - } - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/predef.iterators/counted.iterator/assert.pass.cpp b/libcxx/test/libcxx-03/iterators/predef.iterators/counted.iterator/assert.pass.cpp deleted file mode 100644 index 2fafe47..0000000 --- a/libcxx/test/libcxx-03/iterators/predef.iterators/counted.iterator/assert.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <iterator> - -#include "check_assertion.h" -#include "test_iterators.h" - -int main(int, char**) { - using Iter = std::counted_iterator<int*>; - int a[] = {1, 2, 3}; - Iter valid_i(a, 1); - - { - Iter i; - - TEST_LIBCPP_ASSERT_FAILURE(*i, "Iterator is equal to or past end."); - TEST_LIBCPP_ASSERT_FAILURE(i[999], "Subscript argument must be less than size."); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::iter_move(i), "Iterator must not be past end of range."); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::iter_swap(i, valid_i), "Iterators must not be past end of range."); - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::iter_swap(valid_i, i), "Iterators must not be past end of range."); - std::ranges::iter_swap(valid_i, valid_i); // Ok - } - - { // Check the `const` overload of `operator*`. - const Iter i; - - TEST_LIBCPP_ASSERT_FAILURE(*i, "Iterator is equal to or past end."); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/predef.iterators/iterators.common/assert.pass.cpp b/libcxx/test/libcxx-03/iterators/predef.iterators/iterators.common/assert.pass.cpp deleted file mode 100644 index 01c0fb4..0000000 --- a/libcxx/test/libcxx-03/iterators/predef.iterators/iterators.common/assert.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <iterator> - -#include "check_assertion.h" -#include "test_iterators.h" - -int main(int, char**) { - using Iter = std::common_iterator<int*, sentinel_wrapper<int*>>; - int a[] = {1, 2, 3}; - sentinel_wrapper<int*> s; - Iter valid_i = a; - - { - Iter i = s; - - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable common_iterator"); - - TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-dereferenceable common_iterator"); - TEST_LIBCPP_ASSERT_FAILURE(i++, "Attempted to increment a non-dereferenceable common_iterator"); - - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::iter_move(i), "Attempted to iter_move a non-dereferenceable common_iterator"); - - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::iter_swap(i, valid_i), "Attempted to iter_swap a non-dereferenceable common_iterator"); - TEST_LIBCPP_ASSERT_FAILURE( - std::ranges::iter_swap(valid_i, i), "Attempted to iter_swap a non-dereferenceable common_iterator"); - std::ranges::iter_swap(valid_i, valid_i); // Ok - } - - { // Check the `const` overload of `operator*`. - const Iter i = s; - TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable common_iterator"); - } - - { // Check `operator->`. - struct Foo { - int x = 0; - }; - - std::common_iterator<Foo*, sentinel_wrapper<Foo*>> i = sentinel_wrapper<Foo*>(); - TEST_LIBCPP_ASSERT_FAILURE(i->x, "Attempted to dereference a non-dereferenceable common_iterator"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/iterators/predef.iterators/reverse.iterators/bad_template_argument.verify.cpp b/libcxx/test/libcxx-03/iterators/predef.iterators/reverse.iterators/bad_template_argument.verify.cpp deleted file mode 100644 index 997e611..0000000 --- a/libcxx/test/libcxx-03/iterators/predef.iterators/reverse.iterators/bad_template_argument.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <iterator> - -// reverse_iterator - -#include <iterator> - -#include "test_iterators.h" - -void f() { - using BadIter = std::reverse_iterator<forward_iterator<int*>>; - BadIter i; //expected-error-re@*:* {{static assertion failed{{.*}}reverse_iterator<It> requires It to be a bidirectional iterator.}} -} diff --git a/libcxx/test/libcxx-03/language.support/cxa_deleted_virtual.pass.cpp b/libcxx/test/libcxx-03/language.support/cxa_deleted_virtual.pass.cpp deleted file mode 100644 index 883e176..0000000 --- a/libcxx/test/libcxx-03/language.support/cxa_deleted_virtual.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Test exporting the symbol: "__cxa_deleted_virtual" in macosx -// But don't expect the symbol to be exported in previous versions. -// -// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{13|14}} - -struct S { virtual void f() = delete; virtual ~S() {} }; -int main(int, char**) { - S *s = new S; - delete s; - - return 0; -} diff --git a/libcxx/test/libcxx-03/language.support/no_specializations.verify.cpp b/libcxx/test/libcxx-03/language.support/no_specializations.verify.cpp deleted file mode 100644 index b7b75b7..0000000 --- a/libcxx/test/libcxx-03/language.support/no_specializations.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Check that user-specializations are diagnosed -// See [cmp.result]/1 - -#include <compare> - -#if !__has_warning("-Winvalid-specialization") -// expected-no-diagnostics -#else -struct S {}; - -template <> -struct std::compare_three_way_result<S>; // expected-error {{cannot be specialized}} -#endif diff --git a/libcxx/test/libcxx-03/language.support/support.dynamic/assert.nothrow_new_not_overridden_fno_exceptions.pass.cpp b/libcxx/test/libcxx-03/language.support/support.dynamic/assert.nothrow_new_not_overridden_fno_exceptions.pass.cpp deleted file mode 100644 index fb26bdf..0000000 --- a/libcxx/test/libcxx-03/language.support/support.dynamic/assert.nothrow_new_not_overridden_fno_exceptions.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// void* operator new(std::size_t, const std::nothrow_t&); -// void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&); -// void* operator new[](std::size_t, const std::nothrow_t&); -// void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&); - -// This test ensures that we catch the case where `new` has been overridden but `new(nothrow)` -// has not been overridden, and the library is compiled with -fno-exceptions. -// -// In that case, it is impossible for libc++ to provide a Standards conforming implementation -// of `new(nothrow)`, so the only viable option is to terminate the program. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 - -// We only know how to diagnose this on platforms that use the ELF or Mach-O object file formats. -// XFAIL: target={{.+}}-windows-{{.+}} - -// TODO: We currently don't have a way to express that the built library was -// compiled with -fno-exceptions, so if the library was built with support -// for exceptions but we run the test suite without exceptions, this will -// spuriously fail. -// REQUIRES: no-exceptions - -#include <cstddef> -#include <new> - -#include "check_assertion.h" - -// Override the throwing versions of operator new, but not the nothrow versions. -alignas(32) char DummyData[32 * 3]; -void* operator new(std::size_t) { return DummyData; } -void* operator new(std::size_t, std::align_val_t) { return DummyData; } -void* operator new[](std::size_t) { return DummyData; } -void* operator new[](std::size_t, std::align_val_t) { return DummyData; } - -void operator delete(void*) noexcept {} -void operator delete(void*, std::align_val_t) noexcept {} -void operator delete[](void*) noexcept {} -void operator delete[](void*, std::align_val_t) noexcept {} - -int main(int, char**) { - std::size_t size = 3; - std::align_val_t align = static_cast<std::align_val_t>(32); - EXPECT_ANY_DEATH((void)operator new(size, std::nothrow)); - EXPECT_ANY_DEATH((void)operator new(size, align, std::nothrow)); - EXPECT_ANY_DEATH((void)operator new[](size, std::nothrow)); - EXPECT_ANY_DEATH((void)operator new[](size, align, std::nothrow)); - - return 0; -} diff --git a/libcxx/test/libcxx-03/language.support/support.dynamic/new_dont_return_nullptr.pass.cpp b/libcxx/test/libcxx-03/language.support/support.dynamic/new_dont_return_nullptr.pass.cpp deleted file mode 100644 index 02b20a8..0000000 --- a/libcxx/test/libcxx-03/language.support/support.dynamic/new_dont_return_nullptr.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// void* operator new(std::size_t); -// void* operator new(std::size_t, std::align_val_t); -// void* operator new[](std::size_t); -// void* operator new[](std::size_t, std::align_val_t); - -// This test ensures that we abort the program instead of returning nullptr -// when we fail to satisfy the allocation request. The throwing versions of -// `operator new` must never return nullptr on failure to allocate (per the -// Standard) and the compiler actually relies on that for optimizations. -// Returning nullptr from the throwing `operator new` can basically result -// in miscompiles. - -// REQUIRES: has-unix-headers -// REQUIRES: no-exceptions -// UNSUPPORTED: c++03, c++11, c++14 - -#include <cstddef> -#include <limits> -#include <new> - -#include "check_assertion.h" - -int main(int, char**) { - EXPECT_ANY_DEATH((void)operator new(std::numeric_limits<std::size_t>::max())); - EXPECT_ANY_DEATH((void)operator new(std::numeric_limits<std::size_t>::max(), static_cast<std::align_val_t>(32))); - EXPECT_ANY_DEATH((void)operator new[](std::numeric_limits<std::size_t>::max())); - EXPECT_ANY_DEATH((void)operator new[](std::numeric_limits<std::size_t>::max(), static_cast<std::align_val_t>(32))); - return 0; -} diff --git a/libcxx/test/libcxx-03/language.support/timespec_get.xopen.compile.pass.cpp b/libcxx/test/libcxx-03/language.support/timespec_get.xopen.compile.pass.cpp deleted file mode 100644 index 134978d..0000000 --- a/libcxx/test/libcxx-03/language.support/timespec_get.xopen.compile.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 breaks when enabling LSV. -// UNSUPPORTED: clang-modules-build - -// UNSUPPORTED: c++03, c++11, c++14 - -// Make sure that <ctime> can be included even when _XOPEN_SOURCE is defined. -// This used to trigger some bug in Apple SDKs, since timespec_get was not -// defined in <time.h> but we tried using it from <ctime>. -// See https://llvm.org/PR47208 for details. - -// ADDITIONAL_COMPILE_FLAGS: -D_XOPEN_SOURCE=500 - -#include <ctime> diff --git a/libcxx/test/libcxx-03/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp deleted file mode 100644 index a536e6e..0000000 --- a/libcxx/test/libcxx-03/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// XFAIL: no-wide-characters - -// UNSUPPORTED: c++03 - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT -D_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT - -// <locale> - -// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc> - -// wstring_convert(wstring_convert&& other); // EXTENSION - -#include <locale> -#include <codecvt> -#include <cassert> - -#include "test_macros.h" - -int main(int, char**) -{ - typedef std::codecvt_utf8<wchar_t> Codecvt; - typedef std::wstring_convert<Codecvt> Myconv; - // create a converter and perform some conversions to generate some - // interesting state. - Myconv myconv; - myconv.from_bytes("\xEF\xBF\xBD"); - const auto old_converted = myconv.converted(); - assert(myconv.converted() == 3); - // move construct a new converter and make sure the state is the same. - Myconv myconv2(std::move(myconv)); - assert(myconv2.converted() == old_converted); - - return 0; -} diff --git a/libcxx/test/libcxx-03/mem/mem.res/nodiscard.verify.cpp b/libcxx/test/libcxx-03/mem/mem.res/nodiscard.verify.cpp deleted file mode 100644 index 9ccdcff..0000000 --- a/libcxx/test/libcxx-03/mem/mem.res/nodiscard.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// check that functions are marked [[nodiscard]] as an extension in C++17 - -// [[nodiscard]] std::pmr::memory_resource::allocate(size_t, size_t); -// [[nodiscard]] std::pmr::polymorphic_allocator<T>::allocate(size_t, size_t); - -#include <memory_resource> - -void f() { - std::pmr::memory_resource* res = nullptr; - res->allocate(0); // expected-warning {{ignoring return value of function}} - res->allocate(0, 1); // expected-warning {{ignoring return value of function}} - - std::pmr::polymorphic_allocator<int> poly; - poly.allocate(0); // expected-warning {{ignoring return value of function}} -} diff --git a/libcxx/test/libcxx-03/memory/aligned_allocation_macro.compile.pass.cpp b/libcxx/test/libcxx-03/memory/aligned_allocation_macro.compile.pass.cpp deleted file mode 100644 index 6249c52..0000000 --- a/libcxx/test/libcxx-03/memory/aligned_allocation_macro.compile.pass.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -#include <new> - -#include "test_macros.h" - -#if !_LIBCPP_HAS_ALIGNED_ALLOCATION -# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it" -#endif diff --git a/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp b/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp deleted file mode 100644 index cf11d07..0000000 --- a/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// - -// <memory> -// UNSUPPORTED: c++03, c++11, c++14 - -// template<typename _Alloc> -// struct __is_allocator; - -// Is either true_type or false_type depending on if A is an allocator. - -#include <memory> -#include <string> - -#include "test_macros.h" -#include "min_allocator.h" -#include "test_allocator.h" - -template <typename T> -void test_allocators() -{ - static_assert(!std::__is_allocator<T>::value, "" ); - static_assert( std::__is_allocator<std::allocator<T>>::value, "" ); - static_assert( std::__is_allocator<test_allocator<T>>::value, "" ); - static_assert( std::__is_allocator<min_allocator<T>>::value, "" ); -} - - -int main(int, char**) -{ - // test_allocators<void>(); - test_allocators<char>(); - test_allocators<int>(); - test_allocators<std::string>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/memory/shared_ptr_array.pass.cpp b/libcxx/test/libcxx-03/memory/shared_ptr_array.pass.cpp deleted file mode 100644 index cc8c74383..0000000 --- a/libcxx/test/libcxx-03/memory/shared_ptr_array.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// These compiler versions and platforms don't enable sized deallocation by default. -// ADDITIONAL_COMPILE_FLAGS(clang-17): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(clang-18): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(apple-clang-15): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(apple-clang-16): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(target=x86_64-w64-windows-gnu): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(target=i686-w64-windows-gnu): -fsized-deallocation - -// This test will fail with ASan if the implementation passes different sizes -// to corresponding allocation and deallocation functions. - -#include <memory> - -int main(int, char**) { - std::allocate_shared<int[]>(std::allocator<int>{}, 10); - std::make_shared<int[]>(10); - - std::allocate_shared<int[10]>(std::allocator<int>{}); - std::make_shared<int[10]>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/shared_ptr_arg.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/shared_ptr_arg.pass.cpp deleted file mode 100644 index 601c6c2..0000000 --- a/libcxx/test/libcxx-03/memory/trivial_abi/shared_ptr_arg.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// Test shared_ptr<T> with trivial_abi as parameter type. - -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI - -// XFAIL: gcc -// UNSUPPORTED: c++03 - -#include <memory> -#include <cassert> - -__attribute__((noinline)) void call_something() { asm volatile(""); } - -struct Node { - int* shared_val; - - explicit Node(int* ptr) : shared_val(ptr) {} - ~Node() { ++(*shared_val); } -}; - -__attribute__((noinline)) bool get_val(std::shared_ptr<Node> /*unused*/) { - call_something(); - return true; -} - -__attribute__((noinline)) void expect_1(int* shared, bool /*unused*/) { - assert(*shared == 1); -} - -int main(int, char**) { - int shared = 0; - - // Without trivial-abi, the shared_ptr is deleted at the end of this - // statement; expect_1 will see shared == 0 because it's not incremented (in - // ~Node()) until expect_1 returns. - // - // With trivial-abi, expect_1 will see shared == 1 because shared_val is - // incremented before get_val returns. - expect_1(&shared, get_val(std::make_shared<Node>(&shared))); - - return 0; -} diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_array.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_array.pass.cpp deleted file mode 100644 index e11dc07..0000000 --- a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_array.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <memory> - -// Test unique_ptr<T[]> with trivial_abi as parameter type. - -// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI - -// XFAIL: gcc -// UNSUPPORTED: c++03 - -#include <memory> -#include <cassert> - -__attribute__((noinline)) void call_something() { asm volatile(""); } - -struct Node { - int* shared_val; - - explicit Node(int* ptr) : shared_val(ptr) {} - Node(const Node&) = default; - Node& operator=(const Node&) = default; - ~Node() { ++(*shared_val); } -}; - -__attribute__((noinline)) bool get_val(std::unique_ptr<Node[]> /*unused*/) { - call_something(); - return true; -} - -__attribute__((noinline)) void expect_3(int* shared, bool /*unused*/) { - assert(*shared == 3); -} - -int main(int, char**) { - int shared = 0; - - // Without trivial-abi, the unique_ptr is deleted at the end of this - // statement, expect_3 will see shared == 0 because it's not incremented (in - // ~Node()) until the end of this statement. - // - // With trivial-abi, shared_val is incremented 3 times before get_val returns - // because ~Node() was called 3 times. - expect_3(&shared, get_val(std::unique_ptr<Node[]>(new Node[3]{ - Node(&shared), Node(&shared), Node(&shared)}))); - - // Check that shared_value is still 3 (ie., ~Node() isn't called again by the end of the full-expression above) - expect_3(&shared, true); - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/c.math/constexpr-cxx23-clang.pass.cpp b/libcxx/test/libcxx-03/numerics/c.math/constexpr-cxx23-clang.pass.cpp deleted file mode 100644 index 3f17f21e..0000000 --- a/libcxx/test/libcxx-03/numerics/c.math/constexpr-cxx23-clang.pass.cpp +++ /dev/null @@ -1,266 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that Clang supports constexpr <cmath> and <cstdlib> functions -// mentioned in the P0533R9 paper that is part of C++23 -// (https://wg21.link/p0533r9) -// -// Every function called in this test should become constexpr. Whenever some -// of the desired function become constexpr, the programmer switches -// `ASSERT_NOT_CONSTEXPR_CXX23` to `ASSERT_CONSTEXPR_CXX23` and eventually the -// paper is implemented in Clang. -// The test also works as a reference list of unimplemented functions. -// -// REQUIRES: clang -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// We don't control the implementation of these functions on windows -// UNSUPPORTED: windows - -#include <cmath> -#include <cstdlib> -#include <cassert> - -int main(int, char**) { - bool ImplementedP0533R9 = true; - -#define ASSERT_CONSTEXPR_CXX23(Expr) static_assert(__builtin_constant_p(Expr) && (Expr)) -#define ASSERT_NOT_CONSTEXPR_CXX23(Expr) \ - static_assert(!__builtin_constant_p(Expr)); \ - assert(Expr); \ - ImplementedP0533R9 = false - - int DummyInt; - float DummyFloat; - double DummyDouble; - long double DummyLongDouble; - - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1L) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1LL) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::labs(-1L) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::llabs(-1LL) == 1LL); - - ASSERT_NOT_CONSTEXPR_CXX23(std::div(13, 5).rem == 3); - ASSERT_NOT_CONSTEXPR_CXX23(std::div(13L, 5L).rem == 3L); - ASSERT_NOT_CONSTEXPR_CXX23(std::div(13LL, 5LL).rem == 3LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldiv(13L, 5L).rem == 3L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lldiv(13LL, 5LL).rem == 3LL); - - ASSERT_NOT_CONSTEXPR_CXX23(std::frexp(0.0f, &DummyInt) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexp(0.0, &DummyInt) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexp(0.0L, &DummyInt) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexpf(0.0f, &DummyInt) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexpl(0.0L, &DummyInt) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogb(1.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogb(1.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogb(1.0L) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogbf(1.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogbl(1.0L) == 0); - - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexp(1.0f, 1) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexp(1.0, 1) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexp(1.0L, 1) == 2.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexpf(1.0f, 1) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexpl(1.0L, 1) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::logb(1.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::logb(1.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::logb(1.0L) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::logbf(1.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::logbl(1.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::modf(1.0f, &DummyFloat) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::modf(1.0, &DummyDouble) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::modf(1.0L, &DummyLongDouble) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::modff(1.0f, &DummyFloat) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::modfl(1.0L, &DummyLongDouble) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbn(1.0f, 1) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbn(1.0, 1) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbn(1.0L, 1) == 2.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbnf(1.0f, 1) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbnl(1.0L, 1) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbln(1.0f, 1L) == 2); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbln(1.0, 1L) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbln(1.0L, 1L) == 2.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalblnf(1.0f, 1L) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalblnl(1.0L, 1L) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fabs(-1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fabs(-1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fabs(-1.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::fabsf(-1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fabsl(-1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::ceil(0.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::ceil(0.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ceil(0.0L) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::ceilf(0.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::ceill(0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::floor(1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::floor(1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::floor(1.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::floorf(1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::floorl(1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::round(1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::round(1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::round(1.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::roundf(1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::roundl(1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::lround(1.0f) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lround(1.0) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lround(1.0L) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lroundf(1.0f) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lroundl(1.0L) == 1L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::llround(1.0f) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::llround(1.0) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::llround(1.0L) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::llroundf(1.0f) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::llroundl(1.0L) == 1LL); - - ASSERT_NOT_CONSTEXPR_CXX23(std::trunc(1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::trunc(1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::trunc(1.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::truncf(1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::truncl(1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fmod(1.5f, 1.0f) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmod(1.5, 1.0) == 0.5); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmod(1.5L, 1.0L) == 0.5L); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmodf(1.5f, 1.0f) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmodl(1.5L, 1.0L) == 0.5L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::remainder(0.5f, 1.0f) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::remainder(0.5, 1.0) == 0.5); - ASSERT_NOT_CONSTEXPR_CXX23(std::remainder(0.5L, 1.0L) == 0.5L); - ASSERT_NOT_CONSTEXPR_CXX23(std::remainderf(0.5f, 1.0f) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::remainderl(0.5L, 1.0L) == 0.5L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::remquo(0.5f, 1.0f, &DummyInt) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquo(0.5, 1.0, &DummyInt) == 0.5); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquo(0.5L, 1.0L, &DummyInt) == 0.5L); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquof(0.5f, 1.0f, &DummyInt) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquol(0.5L, 1.0L, &DummyInt) == 0.5L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::copysign(1.0f, 1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::copysign(1.0, 1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::copysign(1.0L, 1.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::copysignf(1.0f, 1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::copysignl(1.0L, 1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafter(0.0f, 0.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafter(0.0, 0.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafter(0.0L, 0.0L) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafterf(0.0f, 0.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafterl(0.0L, 0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttoward(0.0f, 0.0L) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttoward(0.0, 0.0L) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttoward(0.0L, 0.0L) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttowardf(0.0f, 0.0L) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttowardl(0.0L, 0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fdim(1.0f, 0.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fdim(1.0, 0.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fdim(1.0L, 0.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::fdimf(1.0f, 0.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fdiml(1.0L, 0.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fmax(1.0f, 0.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmax(1.0, 0.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmax(1.0L, 0.0L) == 1.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmaxf(1.0f, 0.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmaxl(1.0L, 0.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fmin(1.0f, 0.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmin(1.0, 0.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmin(1.0L, 0.0L) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::fminf(1.0f, 0.0f) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fminl(1.0L, 0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fma(1.0f, 1.0f, 1.0f) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fma(1.0, 1.0, 1.0) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fma(1.0L, 1.0L, 1.0L) == 2.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmaf(1.0f, 1.0f, 1.0f) == 2.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmal(1.0L, 1.0L, 1.0L) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fpclassify(-1.0f) == FP_NORMAL); - ASSERT_NOT_CONSTEXPR_CXX23(std::fpclassify(-1.0) == FP_NORMAL); - ASSERT_NOT_CONSTEXPR_CXX23(std::fpclassify(-1.0L) == FP_NORMAL); - - ASSERT_CONSTEXPR_CXX23(std::isfinite(-1.0f) == 1); - ASSERT_CONSTEXPR_CXX23(std::isfinite(-1.0) == 1); - ASSERT_CONSTEXPR_CXX23(std::isfinite(-1.0L) == 1); - - ASSERT_CONSTEXPR_CXX23(std::isinf(-1.0f) == 0); - ASSERT_CONSTEXPR_CXX23(std::isinf(-1.0) == 0); - ASSERT_CONSTEXPR_CXX23(std::isinf(-1.0L) == 0); - - ASSERT_CONSTEXPR_CXX23(std::isnan(-1.0f) == 0); - ASSERT_CONSTEXPR_CXX23(std::isnan(-1.0) == 0); - ASSERT_CONSTEXPR_CXX23(std::isnan(-1.0L) == 0); - - ASSERT_CONSTEXPR_CXX23(std::isnormal(-1.0f) == 1); - ASSERT_CONSTEXPR_CXX23(std::isnormal(-1.0) == 1); - ASSERT_CONSTEXPR_CXX23(std::isnormal(-1.0L) == 1); - -// TODO(LLVM 22): Remove `__has_constexpr_builtin` conditional once support for Clang 19 is dropped. -#if !__has_constexpr_builtin(__builtin_signbit) - ASSERT_NOT_CONSTEXPR_CXX23(std::signbit(-1.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::signbit(-1.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::signbit(-1.0L) == 1); -#else - ASSERT_CONSTEXPR_CXX23(std::signbit(-1.0f) == 1); - ASSERT_CONSTEXPR_CXX23(std::signbit(-1.0) == 1); - ASSERT_CONSTEXPR_CXX23(std::signbit(-1.0L) == 1); -#endif - - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreater(-1.0f, 0.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreater(-1.0, 0.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreater(-1.0L, 0.0L) == 0); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreaterequal(-1.0f, 0.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreaterequal(-1.0, 0.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreaterequal(-1.0L, 0.0L) == 0); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isless(-1.0f, 0.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::isless(-1.0, 0.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::isless(-1.0L, 0.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::islessequal(-1.0f, 0.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessequal(-1.0, 0.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessequal(-1.0L, 0.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::islessgreater(-1.0f, 0.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessgreater(-1.0, 0.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessgreater(-1.0L, 0.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isunordered(-1.0f, 0.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isunordered(-1.0, 0.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isunordered(-1.0L, 0.0L) == 0); - - assert(!ImplementedP0533R9 && R"( -Congratulations! You just have implemented P0533R9 (https://wg21.link/p0533r9). -Please go to `clang/www/cxx_status.html` and change the paper's implementation -status. Also please delete this assert and refactor `ASSERT_CONSTEXPR_CXX23` -and `ASSERT_NOT_CONSTEXPR_CXX23`. -)"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/c.math/constexpr-cxx23-gcc.pass.cpp b/libcxx/test/libcxx-03/numerics/c.math/constexpr-cxx23-gcc.pass.cpp deleted file mode 100644 index d877970..0000000 --- a/libcxx/test/libcxx-03/numerics/c.math/constexpr-cxx23-gcc.pass.cpp +++ /dev/null @@ -1,256 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that GCC supports constexpr <cmath> and <cstdlib> functions -// mentioned in the P0533R9 paper that is part of C++23 -// (https://wg21.link/p0533r9) -// -// Every function called in this test should become constexpr. Whenever some -// of the desired function become constexpr, the programmer switches -// `ASSERT_NOT_CONSTEXPR_CXX23` to `ASSERT_CONSTEXPR_CXX23` and eventually the -// paper is implemented in Clang. -// The test also works as a reference list of unimplemented functions. -// -// REQUIRES: gcc -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -#include <cmath> -#include <cstdlib> -#include <cassert> - -int main(int, char**) { - bool ImplementedP0533R9 = true; - -#define ASSERT_CONSTEXPR_CXX23(Expr) static_assert(__builtin_constant_p(Expr) && (Expr)) -#define ASSERT_NOT_CONSTEXPR_CXX23(Expr) \ - static_assert(!__builtin_constant_p(Expr)); \ - assert(Expr); \ - ImplementedP0533R9 = false - - int DummyInt; - float DummyFloat; - double DummyDouble; - long double DummyLongDouble; - - ASSERT_CONSTEXPR_CXX23(std::abs(-1) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1L) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1LL) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1.0f) == 1.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::abs(-1.0L) == 1.0L); - - ASSERT_CONSTEXPR_CXX23(std::labs(-1L) == 1L); - ASSERT_CONSTEXPR_CXX23(std::llabs(-1LL) == 1LL); - - ASSERT_NOT_CONSTEXPR_CXX23(std::div(13, 5).rem == 3); - ASSERT_NOT_CONSTEXPR_CXX23(std::div(13L, 5L).rem == 3L); - ASSERT_NOT_CONSTEXPR_CXX23(std::div(13LL, 5LL).rem == 3LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldiv(13L, 5L).rem == 3L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lldiv(13LL, 5LL).rem == 3LL); - - ASSERT_NOT_CONSTEXPR_CXX23(std::frexp(0.0f, &DummyInt) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexp(0.0, &DummyInt) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexp(0.0L, &DummyInt) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexpf(0.0f, &DummyInt) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::frexpl(0.0L, &DummyInt) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogb(1.0f) == 0); - ASSERT_CONSTEXPR_CXX23(std::ilogb(1.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ilogb(1.0L) == 0); - ASSERT_CONSTEXPR_CXX23(std::ilogbf(1.0f) == 0); - ASSERT_CONSTEXPR_CXX23(std::ilogbl(1.0L) == 0); - - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexp(1.0f, 1) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::ldexp(1.0, 1) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ldexp(1.0L, 1) == 2.0L); - ASSERT_CONSTEXPR_CXX23(std::ldexpf(1.0f, 1) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::ldexpl(1.0L, 1) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::logb(1.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::logb(1.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::logb(1.0L) == 0.0L); - ASSERT_CONSTEXPR_CXX23(std::logbf(1.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::logbl(1.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::modf(1.0f, &DummyFloat) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::modf(1.0, &DummyDouble) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::modf(1.0L, &DummyLongDouble) == 0.0L); - ASSERT_NOT_CONSTEXPR_CXX23(std::modff(1.0f, &DummyFloat) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::modfl(1.0L, &DummyLongDouble) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbn(1.0f, 1) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::scalbn(1.0, 1) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbn(1.0L, 1) == 2.0L); - ASSERT_CONSTEXPR_CXX23(std::scalbnf(1.0f, 1) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::scalbnl(1.0L, 1) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbln(1.0f, 1L) == 2); - ASSERT_CONSTEXPR_CXX23(std::scalbln(1.0, 1L) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::scalbln(1.0L, 1L) == 2.0L); - ASSERT_CONSTEXPR_CXX23(std::scalblnf(1.0f, 1L) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::scalblnl(1.0L, 1L) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fabs(-1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::fabs(-1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fabs(-1.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::fabsf(-1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::fabsl(-1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::ceil(0.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::ceil(0.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::ceil(0.0L) == 0.0L); - ASSERT_CONSTEXPR_CXX23(std::ceilf(0.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::ceill(0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::floor(1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::floor(1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::floor(1.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::floorf(1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::floorl(1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::round(1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::round(1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::round(1.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::roundf(1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::roundl(1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::lround(1.0f) == 1L); - ASSERT_CONSTEXPR_CXX23(std::lround(1.0) == 1L); - ASSERT_NOT_CONSTEXPR_CXX23(std::lround(1.0L) == 1L); - ASSERT_CONSTEXPR_CXX23(std::lroundf(1.0f) == 1L); - ASSERT_CONSTEXPR_CXX23(std::lroundl(1.0L) == 1L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::llround(1.0f) == 1LL); - ASSERT_CONSTEXPR_CXX23(std::llround(1.0) == 1LL); - ASSERT_NOT_CONSTEXPR_CXX23(std::llround(1.0L) == 1LL); - ASSERT_CONSTEXPR_CXX23(std::llroundf(1.0f) == 1LL); - ASSERT_CONSTEXPR_CXX23(std::llroundl(1.0L) == 1LL); - - ASSERT_NOT_CONSTEXPR_CXX23(std::trunc(1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::trunc(1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::trunc(1.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::truncf(1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::truncl(1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fmod(1.5f, 1.0f) == 0.5f); - ASSERT_CONSTEXPR_CXX23(std::fmod(1.5, 1.0) == 0.5); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmod(1.5L, 1.0L) == 0.5L); - ASSERT_CONSTEXPR_CXX23(std::fmodf(1.5f, 1.0f) == 0.5f); - ASSERT_CONSTEXPR_CXX23(std::fmodl(1.5L, 1.0L) == 0.5L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::remainder(0.5f, 1.0f) == 0.5f); - ASSERT_CONSTEXPR_CXX23(std::remainder(0.5, 1.0) == 0.5); - ASSERT_NOT_CONSTEXPR_CXX23(std::remainder(0.5L, 1.0L) == 0.5L); - ASSERT_CONSTEXPR_CXX23(std::remainderf(0.5f, 1.0f) == 0.5f); - ASSERT_CONSTEXPR_CXX23(std::remainderl(0.5L, 1.0L) == 0.5L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::remquo(0.5f, 1.0f, &DummyInt) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquo(0.5, 1.0, &DummyInt) == 0.5); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquo(0.5L, 1.0L, &DummyInt) == 0.5L); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquof(0.5f, 1.0f, &DummyInt) == 0.5f); - ASSERT_NOT_CONSTEXPR_CXX23(std::remquol(0.5L, 1.0L, &DummyInt) == 0.5L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::copysign(1.0f, 1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::copysign(1.0, 1.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::copysign(1.0L, 1.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::copysignf(1.0f, 1.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::copysignl(1.0L, 1.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafter(0.0f, 0.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::nextafter(0.0, 0.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::nextafter(0.0L, 0.0L) == 0.0L); - ASSERT_CONSTEXPR_CXX23(std::nextafterf(0.0f, 0.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::nextafterl(0.0L, 0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttoward(0.0f, 0.0L) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::nexttoward(0.0, 0.0L) == 0.0f); - ASSERT_NOT_CONSTEXPR_CXX23(std::nexttoward(0.0L, 0.0L) == 0.0L); - ASSERT_CONSTEXPR_CXX23(std::nexttowardf(0.0f, 0.0L) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::nexttowardl(0.0L, 0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fdim(1.0f, 0.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::fdim(1.0, 0.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fdim(1.0L, 0.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::fdimf(1.0f, 0.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::fdiml(1.0L, 0.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fmax(1.0f, 0.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::fmax(1.0, 0.0) == 1.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmax(1.0L, 0.0L) == 1.0L); - ASSERT_CONSTEXPR_CXX23(std::fmaxf(1.0f, 0.0f) == 1.0f); - ASSERT_CONSTEXPR_CXX23(std::fmaxl(1.0L, 0.0L) == 1.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fmin(1.0f, 0.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::fmin(1.0, 0.0) == 0.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fmin(1.0L, 0.0L) == 0.0L); - ASSERT_CONSTEXPR_CXX23(std::fminf(1.0f, 0.0f) == 0.0f); - ASSERT_CONSTEXPR_CXX23(std::fminl(1.0L, 0.0L) == 0.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fma(1.0f, 1.0f, 1.0f) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::fma(1.0, 1.0, 1.0) == 2.0); - ASSERT_NOT_CONSTEXPR_CXX23(std::fma(1.0L, 1.0L, 1.0L) == 2.0L); - ASSERT_CONSTEXPR_CXX23(std::fmaf(1.0f, 1.0f, 1.0f) == 2.0f); - ASSERT_CONSTEXPR_CXX23(std::fmal(1.0L, 1.0L, 1.0L) == 2.0L); - - ASSERT_NOT_CONSTEXPR_CXX23(std::fpclassify(-1.0f) == FP_NORMAL); - ASSERT_NOT_CONSTEXPR_CXX23(std::fpclassify(-1.0) == FP_NORMAL); - ASSERT_NOT_CONSTEXPR_CXX23(std::fpclassify(-1.0L) == FP_NORMAL); - - ASSERT_CONSTEXPR_CXX23(std::isfinite(-1.0f) == 1); - ASSERT_CONSTEXPR_CXX23(std::isfinite(-1.0) == 1); - ASSERT_CONSTEXPR_CXX23(std::isfinite(-1.0L) == 1); - - ASSERT_CONSTEXPR_CXX23(std::isinf(-1.0f) == 0); - ASSERT_CONSTEXPR_CXX23(std::isinf(-1.0) == 0); - ASSERT_CONSTEXPR_CXX23(std::isinf(-1.0L) == 0); - - ASSERT_CONSTEXPR_CXX23(std::isnan(-1.0f) == 0); - ASSERT_CONSTEXPR_CXX23(std::isnan(-1.0) == 0); - ASSERT_CONSTEXPR_CXX23(std::isnan(-1.0L) == 0); - - ASSERT_CONSTEXPR_CXX23(std::isnormal(-1.0f) == 1); - ASSERT_CONSTEXPR_CXX23(std::isnormal(-1.0) == 1); - ASSERT_CONSTEXPR_CXX23(std::isnormal(-1.0L) == 1); - - ASSERT_CONSTEXPR_CXX23(std::signbit(-1.0f) == 1); - ASSERT_CONSTEXPR_CXX23(std::signbit(-1.0) == 1); - ASSERT_CONSTEXPR_CXX23(std::signbit(-1.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreater(-1.0f, 0.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreater(-1.0, 0.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreater(-1.0L, 0.0L) == 0); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreaterequal(-1.0f, 0.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreaterequal(-1.0, 0.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isgreaterequal(-1.0L, 0.0L) == 0); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isless(-1.0f, 0.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::isless(-1.0, 0.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::isless(-1.0L, 0.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::islessequal(-1.0f, 0.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessequal(-1.0, 0.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessequal(-1.0L, 0.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::islessgreater(-1.0f, 0.0f) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessgreater(-1.0, 0.0) == 1); - ASSERT_NOT_CONSTEXPR_CXX23(std::islessgreater(-1.0L, 0.0L) == 1); - - ASSERT_NOT_CONSTEXPR_CXX23(std::isunordered(-1.0f, 0.0f) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isunordered(-1.0, 0.0) == 0); - ASSERT_NOT_CONSTEXPR_CXX23(std::isunordered(-1.0L, 0.0L) == 0); - - assert(!ImplementedP0533R9 && R"( -Congratulations! You just have implemented P0533R9 (https://wg21.link/p0533r9). -Please go to `clang/www/cxx_status.html` and change the paper's implementation -status. Also please delete this assert and refactor `ASSERT_CONSTEXPR_CXX23` -and `ASSERT_NOT_CONSTEXPR_CXX23`. -)"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/c.math/constexpr-fns.pass.cpp b/libcxx/test/libcxx-03/numerics/c.math/constexpr-fns.pass.cpp deleted file mode 100644 index ff36293..0000000 --- a/libcxx/test/libcxx-03/numerics/c.math/constexpr-fns.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Check that the overloads of std::__libcpp_{isnan,isinf,isfinite} that take -// floating-point values are evaluatable from constexpr contexts. -// -// These functions need to be constexpr in order to be called from CUDA, see -// https://reviews.llvm.org/D25403. They don't actually need to be -// constexpr-evaluatable, but that's what we check here, since we can't check -// true constexpr-ness. -// -// UNSUPPORTED: c++03 - -#include <cmath> - -#include "test_macros.h" - -static_assert(std::__constexpr_isinf(0.0) == false, ""); - -int main(int, char**) -{ - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/numarray/assert.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/assert.pass.cpp deleted file mode 100644 index 2bdf523..0000000 --- a/libcxx/test/libcxx-03/numerics/numarray/assert.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <valarray> - -// Test hardening assertions for std::valarray. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <valarray> - -#include "check_assertion.h" - -int main(int, char**) { - { // Empty valarray - std::valarray<int> c; - const auto& const_c = c; - TEST_LIBCPP_ASSERT_FAILURE(c[0], "valarray::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(const_c[0], "valarray::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(c[42], "valarray::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(const_c[42], "valarray::operator[] index out of bounds"); - } - - { // Non-empty valarray - std::valarray<int> c(4); - const auto& const_c = c; - (void)c[3]; // Check that there's no assertion on valid access. - TEST_LIBCPP_ASSERT_FAILURE(c[4], "valarray::operator[] index out of bounds"); - (void)const_c[3]; // Check that there's no assertion on valid access. - TEST_LIBCPP_ASSERT_FAILURE(const_c[4], "valarray::operator[] index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/assert.get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/assert.get.pass.cpp deleted file mode 100644 index f883f87..0000000 --- a/libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/assert.get.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <valarray> - -// template<class T> class gslice_array; - -// T __get(size_t i); // where i is out of bounds - -#include <valarray> - -#include "check_assertion.h" - -int main(int, char**) { - unsigned input[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - const unsigned N = sizeof(input) / sizeof(input[0]); - - std::valarray<unsigned> array(input, N); - - { - std::gslice_array<unsigned> result = - array[std::gslice(0, std::valarray<std::size_t>(N, 1), std::valarray<std::size_t>(1, 1))]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(N), "gslice_array.__get() index out of bounds"); - } - { - std::valarray<std::size_t> sizes(2); - sizes[0] = 2; - sizes[1] = 3; - - std::valarray<std::size_t> strides(2); - strides[0] = 6; - strides[1] = 1; - - std::gslice_array<unsigned> result = array[std::gslice(1, sizes, strides)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(6), "gslice_array.__get() index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/assert.get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/assert.get.pass.cpp deleted file mode 100644 index 8bf747e..0000000 --- a/libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/assert.get.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <valarray> - -// template<class T> class indirect_array; - -// T __get(size_t i); // where i is out of bounds - -#include <valarray> - -#include "check_assertion.h" - -int main(int, char**) { - unsigned input[] = {0, 1, 2, 3, 4}; - const unsigned N = sizeof(input) / sizeof(input[0]); - - std::valarray<unsigned> array(input, N); - - { - std::indirect_array<unsigned> result = array[std::valarray<std::size_t>()]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(0), "indirect_array.__get() index out of bounds"); - } - { - std::indirect_array<unsigned> result = array[std::valarray<std::size_t>(std::size_t(0), std::size_t(N))]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(N), "indirect_array.__get() index out of bounds"); - } - - { - std::valarray<std::size_t> indirect(std::size_t(0), std::size_t(3)); - std::indirect_array<unsigned> result = array[indirect]; - indirect[0] = 4; - indirect[1] = 1; - indirect[2] = 3; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(3), "indirect_array.__get() index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.mask.array/assert.get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.mask.array/assert.get.pass.cpp deleted file mode 100644 index a2d2848..0000000 --- a/libcxx/test/libcxx-03/numerics/numarray/class.mask.array/assert.get.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <valarray> - -// template<class T> class mask_array; - -// T __get(size_t i); // where i is out of bounds - -#include <valarray> - -#include "check_assertion.h" - -int main(int, char**) { - unsigned input[] = {0, 1, 2, 3, 4}; - const unsigned N = sizeof(input) / sizeof(input[0]); - - std::valarray<unsigned> array(input, N); - - { - std::mask_array<unsigned> result = array[std::valarray<bool>(false, N)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(0), "mask_array.__get() index out of bounds"); - } - { - std::mask_array<unsigned> result = array[std::valarray<bool>(true, N)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(N), "mask_array.__get() index out of bounds"); - } - - { - std::valarray<bool> mask(false, N); - mask[1] = true; - mask[3] = true; - std::mask_array<unsigned> result = array[mask]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(2), "mask_array.__get() index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.slice.array/assert.get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.slice.array/assert.get.pass.cpp deleted file mode 100644 index 0dbad84..0000000 --- a/libcxx/test/libcxx-03/numerics/numarray/class.slice.array/assert.get.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <valarray> - -// template<class T> class slice_array; - -// T __get(size_t i); // where i is out of bounds - -#include <valarray> - -#include "check_assertion.h" - -int main(int, char**) { - unsigned input[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - const unsigned N = sizeof(input) / sizeof(input[0]); - - std::valarray<unsigned> array(input, N); - - { - std::slice_array<unsigned> result = array[std::slice(0, 0, 0)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(0), "slice_array.__get() index out of bounds"); - } - { - std::slice_array<unsigned> result = array[std::slice(0, N, 1)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(N), "slice_array.__get() index out of bounds"); - } - { - std::slice_array<unsigned> result = array[std::slice(3, 2, 2)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(2), "slice_array.__get() index out of bounds"); - } - - { - std::slice_array<unsigned> result = array[std::slice(1, 3, 4)]; - TEST_LIBCPP_ASSERT_FAILURE(result.__get(3), "slice_array.__get() index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/numeric.ops/midpoint.integer.pass.cpp b/libcxx/test/libcxx-03/numerics/numeric.ops/midpoint.integer.pass.cpp deleted file mode 100644 index ef559ad..0000000 --- a/libcxx/test/libcxx-03/numerics/numeric.ops/midpoint.integer.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// <numeric> - -// template <class _Tp> -// _Tp midpoint(_Tp __a, _Tp __b) noexcept -// - -#include <cassert> -#include <cstddef> -#include <cstdint> -#include <numeric> - -#include "test_macros.h" - -// Users are not supposed to provide template argument lists for -// functions in the standard library (there's an exception for min and max) -// However, libc++ protects against this for pointers. The use of T(0) -// in the test cases resolves potential ambiguity in template argument deduction -// for the std::midpoint function. - -template <typename T> -void test() -{ - ASSERT_SAME_TYPE(T, decltype(std::midpoint<T>(T(0), T(0)))); -} - -int main(int, char**) -{ - test<signed char>(); - test<short>(); - test<int>(); - test<long>(); - test<long long>(); - - test<std::int8_t>(); - test<std::int16_t>(); - test<std::int32_t>(); - test<std::int64_t>(); - - test<unsigned char>(); - test<unsigned short>(); - test<unsigned int>(); - test<unsigned long>(); - test<unsigned long long>(); - - test<std::uint8_t>(); - test<std::uint16_t>(); - test<std::uint32_t>(); - test<std::uint64_t>(); - -#ifndef TEST_HAS_NO_INT128 - test<__int128_t>(); - test<__uint128_t>(); -#endif - - test<char>(); - test<std::ptrdiff_t>(); - test<std::size_t>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/bad_engine.verify.cpp deleted file mode 100644 index 9855d8a..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::bernoulli_distribution dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/bad_engine.verify.cpp deleted file mode 100644 index 1b1bb44..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::binomial_distribution<int> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/bad_engine.verify.cpp deleted file mode 100644 index d9b692e..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/bad_engine.verify.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare -Wno-shift-count-negative - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::geometric_distribution<int> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 7 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/bad_engine.verify.cpp deleted file mode 100644 index e526168..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/bad_engine.verify.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-shift-count-negative - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::negative_binomial_distribution<int> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 7 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/bad_engine.verify.cpp deleted file mode 100644 index 59e5b50..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::cauchy_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/bad_engine.verify.cpp deleted file mode 100644 index b026514..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::chi_squared_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 3 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.f/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.f/bad_engine.verify.cpp deleted file mode 100644 index 77c97fb..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.f/bad_engine.verify.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::fisher_f_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 4 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/bad_engine.verify.cpp deleted file mode 100644 index 80c3458..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::lognormal_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.normal/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.normal/bad_engine.verify.cpp deleted file mode 100644 index cc697ab..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.normal/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::normal_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/bad_engine.verify.cpp deleted file mode 100644 index 151a2bd..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::student_t_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 5 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/bad_engine.verify.cpp deleted file mode 100644 index b124121..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::exponential_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/bad_engine.verify.cpp deleted file mode 100644 index c002716..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::extreme_value_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/bad_engine.verify.cpp deleted file mode 100644 index 8bf87dd..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::gamma_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 3 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/bad_engine.verify.cpp deleted file mode 100644 index ef56d96..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/bad_engine.verify.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-shift-count-negative - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::poisson_distribution<int> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 4 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.weibull/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.weibull/bad_engine.verify.cpp deleted file mode 100644 index e40c197..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.weibull/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::weibull_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/bad_engine.verify.cpp deleted file mode 100644 index a4def06..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::discrete_distribution<int> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/bad_engine.verify.cpp deleted file mode 100644 index 0020711..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::piecewise_constant_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/bad_engine.verify.cpp deleted file mode 100644 index 0fb54a40..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::piecewise_linear_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* 2 {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.uni/rand.dist.uni.int/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.uni/rand.dist.uni.int/bad_engine.verify.cpp deleted file mode 100644 index 2432843..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.uni/rand.dist.uni.int/bad_engine.verify.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::uniform_int_distribution<int> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.uni/rand.dist.uni.real/bad_engine.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.uni/rand.dist.uni.real/bad_engine.verify.cpp deleted file mode 100644 index fa5c3a3e..0000000 --- a/libcxx/test/libcxx-03/numerics/rand/rand.dist/rand.dist.uni/rand.dist.uni.real/bad_engine.verify.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <random> - -#include <random> - -template<class Int> -struct G { - using result_type = Int; - result_type operator()(); - static constexpr result_type min() { return 0; } - static constexpr result_type max() { return 255; } -}; - -void test(std::uniform_real_distribution<double> dist) -{ - G<int> badg; - G<unsigned> okg; - - dist(badg); //expected-error@*:* {{static assertion failed}} //expected-note {{in instantiation}} - dist(okg); -} diff --git a/libcxx/test/libcxx-03/ranges/no_specializations.verify.cpp b/libcxx/test/libcxx-03/ranges/no_specializations.verify.cpp deleted file mode 100644 index 489e3a6..0000000 --- a/libcxx/test/libcxx-03/ranges/no_specializations.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Check that user-specializations are diagnosed -// See [range.adaptor.object]/5 - -#include <ranges> - -#include "test_macros.h" - -#if !__has_warning("-Winvalid-specialization") || TEST_STD_VER <= 20 -// expected-no-diagnostics -#else -struct S {}; - -template <> -class std::ranges::range_adaptor_closure<S>; // expected-error {{cannot be specialized}} -#endif diff --git a/libcxx/test/libcxx-03/ranges/range.access/end.incomplete_type.pass.cpp b/libcxx/test/libcxx-03/ranges/range.access/end.incomplete_type.pass.cpp deleted file mode 100644 index 12efa6a..0000000 --- a/libcxx/test/libcxx-03/ranges/range.access/end.incomplete_type.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++-specific behavior that we handle the IFNDR case for ranges::end -// by being SFINAE-friendly. - -#include <cassert> -#include <ranges> -#include <type_traits> -#include <utility> - -struct Incomplete; - -constexpr bool test() -{ - { - extern Incomplete bounded[10]; - assert((!std::is_invocable_v<decltype(std::ranges::end), decltype((bounded))>)); - assert((!std::is_invocable_v<decltype(std::ranges::cend), decltype((bounded))>)); - assert((!std::is_invocable_v<decltype(std::ranges::end), decltype(std::as_const(bounded))>)); - assert((!std::is_invocable_v<decltype(std::ranges::cend), decltype(std::as_const(bounded))>)); - } - { - extern Incomplete unbounded[]; - assert((!std::is_invocable_v<decltype(std::ranges::end), decltype((unbounded))>)); - assert((!std::is_invocable_v<decltype(std::ranges::cend), decltype((unbounded))>)); - assert((!std::is_invocable_v<decltype(std::ranges::end), decltype(std::as_const(unbounded))>)); - assert((!std::is_invocable_v<decltype(std::ranges::cend), decltype(std::as_const(unbounded))>)); - } - - return true; -} - -int main(int, char**) -{ - test(); - static_assert(test()); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.lifetimebound.verify.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.lifetimebound.verify.cpp deleted file mode 100644 index b60f172..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.lifetimebound.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// template<class T> -// constexpr T& as-lvalue(T&& t) { // exposition only - -#include <__utility/as_lvalue.h> - -void test() { - // Check prvalue - { - [[maybe_unused]] auto& check = std::__as_lvalue( - 0); // expected-warning {{temporary bound to local reference 'check' will be destroyed at the end of the full-expression}} - } -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.pass.cpp deleted file mode 100644 index 8e47a50..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -// template<class T> -// constexpr T& as-lvalue(T&& t) { // exposition only - -#include <__utility/as_lvalue.h> -#include <type_traits> -#include <utility> - -constexpr bool test() { - // Check glvalue - { - int lvalue{}; - [[maybe_unused]] decltype(auto) check = std::__as_lvalue(lvalue); - static_assert(std::is_same<decltype(check), int&>::value, ""); - } - - // Check xvalue - { - int xvalue{}; - [[maybe_unused]] decltype(auto) check = std::__as_lvalue(std::move(xvalue)); - static_assert(std::is_same<decltype(check), int&>::value, ""); - } - - return true; -} - -int main(int, char**) { - test(); - static_assert(test(), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/tuple-for-each.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/tuple-for-each.pass.cpp deleted file mode 100644 index 11176c7..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.adaptor.helpers/tuple-for-each.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <ranges> - -// template<class F, class Tuple> -// constexpr void tuple-for-each(F&& f, Tuple&& t) { // exposition only - -// LWG3755 tuple-for-each can call user-defined operator, - -#include <ranges> -#include <tuple> -#include <cstdlib> - -struct Evil { - void operator,(Evil) { std::abort(); } -}; - -int main(int, char**) { - std::tuple<int, int> t; - std::ranges::__tuple_for_each([](int) { return Evil{}; }, t); - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.all/all.nodiscard.verify.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.all/all.nodiscard.verify.cpp deleted file mode 100644 index 43b9ebf6..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.all/all.nodiscard.verify.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++ extension that std::views::all is marked as [[nodiscard]]. - -#include <ranges> - -void test() { - int range[] = {1, 2, 3}; - - std::views::all(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::views::all; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::all | std::views::all; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.begin.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.begin.pass.cpp deleted file mode 100644 index 57af366..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.begin.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-exceptions -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// Call begin() on chunk_by_view with empty predicate - -#include <ranges> - -#include "check_assertion.h" -#include "types.h" - -int main(int, char**) { - int input[] = {1, 2, 3}; - auto view1 = std::views::chunk_by(input, ThrowOnCopyPred{}); - auto view2 = std::views::chunk_by(input, ThrowOnCopyPred{}); - try { - view1 = view2; - } catch (...) { - } - TEST_LIBCPP_ASSERT_FAILURE( - view1.begin(), "Trying to call begin() on a chunk_by_view that does not have a valid predicate."); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.find-next.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.find-next.pass.cpp deleted file mode 100644 index 1c91ee7..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.find-next.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-exceptions -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// Call find-next() on chunk_by_view with empty predicate - -#include <ranges> - -#include "check_assertion.h" -#include "types.h" - -int main(int, char**) { - int input[] = {1, 2, 3}; - // This is the easiest way to get '__find_next' to fail. If we used default constructed view here, - // then begin() would fail instead of __find_next. - auto view1 = std::views::chunk_by(input, ThrowOnCopyPred{}); - auto view2 = std::views::chunk_by(input, ThrowOnCopyPred{}); - auto it = view1.begin(); - try { - view1 = view2; - } catch (...) { - } - TEST_LIBCPP_ASSERT_FAILURE( - ++it, "Trying to call __find_next() on a chunk_by_view that does not have a valid predicate."); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.find-prev.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.find-prev.pass.cpp deleted file mode 100644 index 2605bf6..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/assert.find-prev.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-exceptions -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// Call find-prev() on chunk_by_view with begin iterator -// Call find-prev() on chunk_by_view with empty predicate - -#include <functional> -#include <ranges> - -#include "check_assertion.h" -#include "types.h" - -int main(int, char**) { - int input[] = {1, 1, 2, 2}; - - { // Call find-prev() on chunk_by_view with begin iterator - auto view = std::views::chunk_by(input, std::equal_to{}); - auto it = view.begin(); - TEST_LIBCPP_ASSERT_FAILURE(--it, "Trying to call __find_prev() on a begin iterator."); - } - - { // Call find-prev() on chunk_by_view with empty predicate - auto view1 = std::views::chunk_by(input, ThrowOnCopyPred{}); - auto view2 = std::views::chunk_by(input, ThrowOnCopyPred{}); - auto it = view1.begin(); - ++it; - try { - view1 = view2; - } catch (...) { - } - TEST_LIBCPP_ASSERT_FAILURE( - --it, "Trying to call __find_prev() on a chunk_by_view that does not have a valid predicate."); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/no_unique_address.compile.pass.cpp deleted file mode 100644 index e696598..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// XFAIL: msvc - -// This test ensures that we use `[[no_unique_address]]` in `chunk_by_view`. - -#include <ranges> - -struct View : std::ranges::view_base { - int* begin() const; - int* end() const; -}; - -struct Pred { - template <class... Args> - bool operator()(const Args&...) const; -}; - -template <class View> -struct Test { - [[no_unique_address]] View view; - char c; -}; - -// [[no_unique_address]] applied to _View -struct ViewWithPadding : View { - alignas(128) char c; -}; - -static_assert(sizeof(Test<std::ranges::chunk_by_view<ViewWithPadding, Pred>>) == - sizeof(std::ranges::chunk_by_view<ViewWithPadding, Pred>)); - -// [[no_unique_address]] applied to movable-box -struct PredWithPadding : Pred { - alignas(128) char c; -}; - -static_assert(sizeof(Test<std::ranges::chunk_by_view<View, PredWithPadding>>) == - sizeof(std::ranges::chunk_by_view<View, PredWithPadding>)); diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/assert.deref.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/assert.deref.pass.cpp deleted file mode 100644 index 8ed84ca..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/assert.deref.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// Dereference past end chunk_by_view iterator - -#include <functional> -#include <ranges> - -#include "check_assertion.h" - -int main(int, char**) { - int input[] = {1, 2, 3}; - auto view = std::views::chunk_by(input, std::less{}); - auto it = view.begin(); - ++it; - TEST_LIBCPP_ASSERT_FAILURE(*it, "Trying to dereference past-the-end chunk_by_view iterator."); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/assert.increment.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/assert.increment.pass.cpp deleted file mode 100644 index 1a804b7..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/assert.increment.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// Increment past end chunk_by_view iterator - -#include <functional> -#include <ranges> - -#include "check_assertion.h" - -int main(int, char**) { - int input[] = {1, 2, 3}; - auto view = std::views::chunk_by(input, std::less{}); - auto it = view.begin(); - ++it; - TEST_LIBCPP_ASSERT_FAILURE(++it, "Trying to increment past end chunk_by_view iterator."); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/types.h b/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/types.h deleted file mode 100644 index 88fbcef..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.chunk.by/types.h +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_CHUNK_BY_TYPES_H -#define TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_CHUNK_BY_TYPES_H - -struct ThrowOnCopyPred { - ThrowOnCopyPred() = default; - ThrowOnCopyPred(const ThrowOnCopyPred&) { throw 0; } - ThrowOnCopyPred& operator=(const ThrowOnCopyPred&) = delete; - - ThrowOnCopyPred(ThrowOnCopyPred&&) = default; - ThrowOnCopyPred& operator=(ThrowOnCopyPred&&) = default; - - bool operator()(int x, int y) const { return x != y; } -}; - -#endif // TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_CHUNK_BY_TYPES_H diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.common.view/adaptor.nodiscard.verify.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.common.view/adaptor.nodiscard.verify.cpp deleted file mode 100644 index bc9d9c9..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.common.view/adaptor.nodiscard.verify.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++ extension that std::views::common is marked as [[nodiscard]]. - -#include <ranges> - -void test() { - int range[] = {1, 2, 3}; - - std::views::common(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::views::common; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::all | std::views::common; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.counted/adaptor.nodiscard.verify.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.counted/adaptor.nodiscard.verify.cpp deleted file mode 100644 index bd9b158..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.counted/adaptor.nodiscard.verify.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++ extension that std::views::counted is marked as [[nodiscard]]. - -#include <ranges> - -void test() { - int range[] = {1, 2, 3}; - - std::views::counted(range, 1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp deleted file mode 100644 index 205cf40..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.drop.while/assert.begin.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <ranges> - -// Call begin() on drop_while_view with empty predicate - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-exceptions -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <ranges> - -#include "check_assertion.h" - -struct Exception {}; -struct ThrowOnCopyPred { - ThrowOnCopyPred() = default; - ThrowOnCopyPred(const ThrowOnCopyPred&) { throw Exception{}; } - ThrowOnCopyPred& operator=(const ThrowOnCopyPred&) = delete; - - ThrowOnCopyPred(ThrowOnCopyPred&&) = default; - ThrowOnCopyPred& operator=(ThrowOnCopyPred&&) = default; - - bool operator()(int) const { return false; } -}; - -int main(int, char**) { - int input[] = {1, 2, 3}; - auto v1 = std::views::drop_while(input, ThrowOnCopyPred{}); - auto v2 = std::views::drop_while(input, ThrowOnCopyPred{}); - try { - v1 = v2; - } catch (...) { - } - TEST_LIBCPP_ASSERT_FAILURE( - v1.begin(), - "drop_while_view needs to have a non-empty predicate before calling begin() -- did a " - "previous assignment to this drop_while_view fail?"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.elements/elements_view.no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.elements/elements_view.no_unique_address.compile.pass.cpp deleted file mode 100644 index 6901745..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.elements/elements_view.no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// clang-cl and cl currently don't support [[no_unique_address]] -// XFAIL: msvc - -// Test the libc++ extension that the base view stored in `std::ranges::elements_view` -// has been marked as _LIBCPP_NO_UNIQUE_ADDRESS - -#include <ranges> -#include <tuple> - - -struct EmptyView : std::ranges::view_base { - std::tuple<int>* begin() const; - std::tuple<int>* end() const; -}; - -using ElementsView = std::ranges::elements_view<EmptyView, 0>; - -struct TestClass { - [[no_unique_address]] ElementsView view; - int i; -}; - -static_assert(sizeof(TestClass) == sizeof(int)); diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.elements/sentinel.no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.elements/sentinel.no_unique_address.compile.pass.cpp deleted file mode 100644 index 2e69a32..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.elements/sentinel.no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// clang-cl and cl currently don't support [[no_unique_address]] -// XFAIL: msvc - -// Test the libc++ extension that the sentinel stored in `std::ranges::elements_view::__sentinel` -// has been marked as _LIBCPP_NO_UNIQUE_ADDRESS - -#include <ranges> -#include <tuple> - -struct EmptySentinel { - friend bool operator==(std::tuple<int>* iter, EmptySentinel) { return iter; } -}; - -struct Range : std::ranges::view_base { - std::tuple<int>* begin() const; - EmptySentinel end() const; -}; - -using ElementsView = std::ranges::elements_view<Range, 0>; -using ElementsSent = std::ranges::sentinel_t<ElementsView>; - -struct TestClass { - [[no_unique_address]] ElementsSent s; - int i; -}; - -static_assert(sizeof(TestClass) == sizeof(int)); diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/ctor.parent.outer.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/ctor.parent.outer.pass.cpp deleted file mode 100644 index a54980b..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/ctor.parent.outer.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// constexpr iterator(Parent& parent, OuterIter outer) -// requires forward_range<Base>; // exposition only - -#include <cassert> -#include <ranges> -#include <string> -#include <utility> - -#include "types.h" - -constexpr bool test() { - std::string strings[4] = {"aaaa", "bbbb", "cccc", "dddd"}; - - { // Check if `outer_` is initialized with `std::move(outer)` for `iterator<false>` - MoveOnAccessSubrange r{DieOnCopyIterator(strings), sentinel_wrapper(strings + 4)}; - std::ranges::join_view jv(std::move(r)); - auto iter = jv.begin(); // Calls `iterator(Parent& parent, OuterIter outer)` - assert(*iter == 'a'); - } - - { // Check if `outer_` is initialized with `std::move(outer)` for `iterator<true>` - MoveOnAccessSubrange r{DieOnCopyIterator(strings), sentinel_wrapper(strings + 4)}; - std::ranges::join_view jv(std::ranges::ref_view{r}); - auto iter = std::as_const(jv).begin(); // Calls `iterator(Parent& parent, OuterIter outer)` - assert(*iter == 'a'); - } - - { - // LWG3569 Inner iterator not default_initializable - // With the current spec, the constructor under test invokes Inner iterator's default constructor - // even if it is not default constructible. - // This test is checking that this constructor can be invoked with an inner range with non default - // constructible iterator. - using NonDefaultCtrIter = cpp20_input_iterator<int*>; - static_assert(!std::default_initializable<NonDefaultCtrIter>); - using NonDefaultCtrIterView = BufferView<NonDefaultCtrIter, sentinel_wrapper<NonDefaultCtrIter>>; - static_assert(std::ranges::input_range<NonDefaultCtrIterView>); - - int buffer[2][2] = {{1, 2}, {3, 4}}; - NonDefaultCtrIterView inners[] = {buffer[0], buffer[1]}; - auto outer = std::views::all(inners); - std::ranges::join_view jv(outer); - auto iter = jv.begin(); // Calls `iterator(Parent& parent, OuterIter outer)` - assert(*iter == 1); - } - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/ctor.parent.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/ctor.parent.pass.cpp deleted file mode 100644 index 3026a02..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/ctor.parent.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// constexpr explicit iterator(Parent& parent) -// requires (!forward_range<Base>); // exposition only - -#include <string> -#include <ranges> - -#include "types.h" - -constexpr bool test() { - std::string strings[4] = {"eeee", "ffff", "gggg", "hhhh"}; - - MoveOnAccessSubrange r{ - DieOnCopyIterator(cpp20_input_iterator(strings)), sentinel_wrapper(cpp20_input_iterator(strings + 4))}; - std::ranges::join_view jv(std::move(r)); - auto iter = jv.begin(); // Calls `iterator(Parent& parent)` - assert(*iter == 'e'); - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/types.h b/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/types.h deleted file mode 100644 index 0652d4b..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/range.join.iterator/types.h +++ /dev/null @@ -1,114 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_JOIN_RANGE_JOIN_ITERATOR_TYPES_H -#define TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_JOIN_RANGE_JOIN_ITERATOR_TYPES_H - -#include <cassert> -#include <cstddef> -#include <ranges> - -#include "test_iterators.h" - -template <std::input_iterator Iter> -struct DieOnCopyIterator { - using value_type = std::iter_value_t<Iter>; - using difference_type = std::iter_difference_t<Iter>; - - DieOnCopyIterator() - requires std::default_initializable<Iter> - = default; - - constexpr explicit DieOnCopyIterator(Iter iter) : iter_(std::move(iter)) {} - constexpr DieOnCopyIterator(DieOnCopyIterator&& other) = default; - DieOnCopyIterator& operator=(DieOnCopyIterator&&) = default; - - constexpr DieOnCopyIterator(const DieOnCopyIterator&) { assert(false); } - constexpr DieOnCopyIterator& operator=(const DieOnCopyIterator&) { assert(false); } - - constexpr DieOnCopyIterator& operator++() { - ++iter_; - return *this; - } - - constexpr void operator++(int) { iter_++; } - - constexpr DieOnCopyIterator operator++(int) - requires std::forward_iterator<Iter> - { - auto tmp = *this; - ++tmp; - return tmp; - } - - constexpr decltype(auto) operator*() const { return *iter_; } - - friend constexpr bool operator==(const DieOnCopyIterator& left, const DieOnCopyIterator& right) - requires std::equality_comparable<Iter> - { - return left.iter_ == right.iter_; - } - - friend constexpr bool operator==(const DieOnCopyIterator& it, const sentinel_wrapper<Iter>& se) { - return it.iter_ == se; - } - -private: - Iter iter_ = Iter(); -}; - -template <class Iter> -explicit DieOnCopyIterator(Iter) -> DieOnCopyIterator<Iter>; - -static_assert(std::input_iterator<DieOnCopyIterator<cpp20_input_iterator<int*>>>); -static_assert(!std::forward_iterator<DieOnCopyIterator<cpp20_input_iterator<int*>>>); -static_assert(std::forward_iterator<DieOnCopyIterator<int*>>); -static_assert(!std::bidirectional_iterator<DieOnCopyIterator<int*>>); -static_assert(std::sentinel_for<sentinel_wrapper<int*>, DieOnCopyIterator<int*>>); - -template <std::input_iterator Iter, std::sentinel_for<Iter> Sent = Iter> -struct MoveOnAccessSubrange : std::ranges::view_base { - constexpr explicit MoveOnAccessSubrange(Iter iter, Sent sent) : iter_(std::move(iter)), sent_(std::move(sent)) {} - - MoveOnAccessSubrange(MoveOnAccessSubrange&&) = default; - MoveOnAccessSubrange& operator=(MoveOnAccessSubrange&&) = default; - - MoveOnAccessSubrange(const MoveOnAccessSubrange&) = delete; - MoveOnAccessSubrange& operator=(const MoveOnAccessSubrange&) = delete; - - constexpr Iter begin() { return std::move(iter_); } - constexpr Sent end() { return std::move(sent_); } - -private: - Iter iter_; - Sent sent_; -}; - -template <class Iter, class Sent> -MoveOnAccessSubrange(Iter, Sent) -> MoveOnAccessSubrange<Iter, Sent>; - -static_assert(std::ranges::input_range<MoveOnAccessSubrange<int*, sentinel_wrapper<int*>>>); -static_assert(std::ranges::forward_range<MoveOnAccessSubrange<DieOnCopyIterator<int*>>>); - -template <class Iter, class Sent> - requires(!std::same_as<Iter, Sent>) -struct BufferView : std::ranges::view_base { - using T = std::iter_value_t<Iter>; - T* data_; - std::size_t size_; - - template <std::size_t N> - constexpr BufferView(T (&b)[N]) : data_(b), size_(N) {} - - constexpr Iter begin() const { return Iter(data_); } - constexpr Sent end() const { return Sent(Iter(data_ + size_)); } -}; - -static_assert(std::ranges::input_range<BufferView<int*, sentinel_wrapper<int*>>>); - -#endif // TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_JOIN_RANGE_JOIN_ITERATOR_TYPES_H diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/segmented_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/segmented_iterator.compile.pass.cpp deleted file mode 100644 index 6cd17c2..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.join/segmented_iterator.compile.pass.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <ranges> -#include <utility> -#include <vector> - -using JoinView = decltype(std::views::join(std::declval<std::vector<std::vector<int>>&>())); -using JoinIter = std::ranges::iterator_t<JoinView>; -static_assert(std::__is_segmented_iterator<JoinIter>::value); diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp deleted file mode 100644 index 4a975f4..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,116 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// class lazy_split_view { -// _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); -// _LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern(); -// }; - -#include <ranges> - -#include <string_view> -#include "test_iterators.h" - -// Verify the optimization that, if `View` is a forward range, the `lazy_split_view` itself doesn't store the `current` -// iterator (instead, it's stored in the `outer-iterator`). -// -// Note that the Standard marks all data members of `lazy_split_view` as "exposition only", so this test has to be -// libc++-specific. -namespace test1 { - - using SplitView = std::ranges::lazy_split_view<std::string_view, std::string_view>; - // The `lazy_split_view` only stores the `View` and the `Pattern`, not an iterator. - static_assert(sizeof(SplitView) == sizeof(std::string_view) * 2); - -} // namespace test1 - -// Verify the optimization that, if `View` is an input range, the `outer-iterator` doesn't store the `current` iterator -// (instead, it's stored in the `lazy_split_view` itself). -// -// Note that the Standard marks all data members of `outer-iterator` as "exposition only", so this test has to be -// libc++-specific. -namespace test2 { - - struct InputView : std::ranges::view_base { - int x; - cpp20_input_iterator<int*> begin() const; - sentinel_wrapper<cpp20_input_iterator<int*>> end() const; - }; - static_assert( std::ranges::input_range<InputView>); - static_assert(!std::ranges::forward_range<InputView>); - static_assert( std::ranges::view<InputView>); - - struct TinyView : std::ranges::view_base { - int x; - int* begin() const; - int* end() const; - constexpr static std::size_t size() { return 1; } - }; - static_assert( std::ranges::forward_range<TinyView>); - static_assert( std::ranges::__tiny_range<TinyView>); - static_assert( std::ranges::view<TinyView>); - - using SplitView = std::ranges::lazy_split_view<InputView, TinyView>; - using OuterIter = std::ranges::iterator_t<SplitView>; - // The `outer-iterator` only stores a pointer to the parent and a boolean (aligned to the size of a pointer), not an - // iterator. - static_assert(sizeof(OuterIter) == sizeof(void*) * 2); - -} // namespace test2 - -// Verify the libc++-specific optimization that empty `View` and `Pattern` use the `[[no_unique_address]]` attribute. -// Both `View` and `Pattern` are forward views. -namespace test3 { - - struct EmptyView1 : std::ranges::view_base { - int* begin() const; - int* end() const; - }; - static_assert( std::ranges::forward_range<EmptyView1>); - static_assert( std::ranges::view<EmptyView1>); - - // Note: it's important to inherit `EmptyView1` and `EmptyView2` from different bases, otherwise they still cannot share - // the same address regardless of whether `[[no_unique_address]]` is used. - struct EmptyView2 : std::ranges::view_interface<EmptyView2> { - int* begin() const; - int* end() const; - }; - static_assert( std::ranges::forward_range<EmptyView2>); - static_assert( std::ranges::view<EmptyView2>); - - static_assert(sizeof(std::ranges::lazy_split_view<EmptyView1, EmptyView2>) == 1); - -} // namespace test3 - -// Verify the libc++-specific optimization that empty `View` and `Pattern` use the `[[no_unique_address]]` attribute. -// `View` is an input view and `Pattern` is a tiny view. -namespace test4 { - - struct EmptyInputView : std::ranges::view_base { - cpp20_input_iterator<int*> begin() const; - sentinel_wrapper<cpp20_input_iterator<int*>> end() const; - }; - static_assert( std::ranges::input_range<EmptyInputView>); - static_assert(!std::ranges::forward_range<EmptyInputView>); - static_assert( std::ranges::view<EmptyInputView>); - - struct EmptyTinyView : std::ranges::view_base { - int* begin() const; - int* end() const; - constexpr static std::size_t size() { return 1; } - }; - static_assert( std::ranges::forward_range<EmptyTinyView>); - static_assert( std::ranges::__tiny_range<EmptyTinyView>); - static_assert( std::ranges::view<EmptyTinyView>); - - static_assert(sizeof(std::ranges::lazy_split_view<EmptyInputView, EmptyTinyView>) == - sizeof(std::ranges::__non_propagating_cache<std::ranges::iterator_t<EmptyInputView>>)); - -} // namespace test4 diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp deleted file mode 100644 index 22ede41..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/assert.equal.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// friend constexpr bool operator==(const inner-iterator& x, default_sentinel_t); -// -// Can't compare a default-constructed `inner-iterator` with the default sentinel. - -#include <ranges> - -#include "check_assertion.h" -#include "../types.h" - -int main(int, char**) { - { - InnerIterForward i; - TEST_LIBCPP_ASSERT_FAILURE(i == std::default_sentinel, "Cannot call comparison on a default-constructed iterator."); - } - - { - InnerIterInput i; - TEST_LIBCPP_ASSERT_FAILURE(i == std::default_sentinel, "Cannot call comparison on a default-constructed iterator."); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp deleted file mode 100644 index b6cbf52..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/assert.equal.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <ranges> - -// friend constexpr bool operator==(const inner-iterator& x, default_sentinel_t); -// -// Can't compare a default-constructed `inner-iterator` with the default sentinel. - -#include <ranges> - -#include "check_assertion.h" -#include "../types.h" - -int main(int, char**) { - { - OuterIterForward i; - TEST_LIBCPP_ASSERT_FAILURE(i == std::default_sentinel, "Cannot call comparison on a default-constructed iterator."); - } - - { - OuterIterInput i; - TEST_LIBCPP_ASSERT_FAILURE(i == std::default_sentinel, "Cannot call comparison on a default-constructed iterator."); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/types.h b/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/types.h deleted file mode 100644 index 12b0de9..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.lazy.split/types.h +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_LAZY_SPLIT_TYPES_H -#define TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_LAZY_SPLIT_TYPES_H - -#include <concepts> -#include <cstddef> -#include <ranges> -#include <string_view> -#include "test_iterators.h" - -// ForwardView - -struct ForwardView : std::ranges::view_base { - constexpr explicit ForwardView() = default; - constexpr ForwardView(ForwardView&&) = default; - constexpr ForwardView& operator=(ForwardView&&) = default; - constexpr forward_iterator<const char*> begin() const { return forward_iterator<const char*>(nullptr); } - constexpr forward_iterator<const char*> end() const { return forward_iterator<const char*>(nullptr); } -}; -static_assert( std::ranges::forward_range<ForwardView>); -static_assert( std::ranges::forward_range<const ForwardView>); -static_assert( std::ranges::view<ForwardView>); -static_assert(!std::is_copy_constructible_v<ForwardView>); - -// InputView - -struct InputView : std::ranges::view_base { - constexpr InputView() = default; - - constexpr cpp20_input_iterator<char*> begin() { return cpp20_input_iterator<char*>(nullptr); } - constexpr sentinel_wrapper<cpp20_input_iterator<char*>> end() { - return sentinel_wrapper(cpp20_input_iterator<char*>(nullptr)); - } - constexpr cpp20_input_iterator<const char*> begin() const { return cpp20_input_iterator<const char*>(nullptr); } - constexpr sentinel_wrapper<cpp20_input_iterator<const char*>> end() const { - return sentinel_wrapper(cpp20_input_iterator<const char*>(nullptr)); - } -}; - -static_assert(std::ranges::input_range<InputView>); -static_assert(std::ranges::input_range<const InputView>); -static_assert(std::ranges::view<InputView>); - -// ForwardTinyView - -struct ForwardTinyView : std::ranges::view_base { - constexpr ForwardTinyView() = default; - constexpr forward_iterator<const char*> begin() const { return forward_iterator<const char*>(nullptr); } - constexpr forward_iterator<const char*> end() const { return forward_iterator<const char*>(nullptr); } - constexpr static std::size_t size() { return 1; } -}; -static_assert(std::ranges::forward_range<ForwardTinyView>); -static_assert(std::ranges::view<ForwardTinyView>); -LIBCPP_STATIC_ASSERT(std::ranges::__tiny_range<ForwardTinyView>); - -// Aliases - -using SplitViewForward = std::ranges::lazy_split_view<ForwardView, ForwardView>; -using OuterIterForward = std::ranges::iterator_t<SplitViewForward>; -using InnerIterForward = std::ranges::iterator_t<OuterIterForward::value_type>; - -using SplitViewInput = std::ranges::lazy_split_view<InputView, ForwardTinyView>; -using OuterIterInput = std::ranges::iterator_t<SplitViewInput>; -using InnerIterInput = std::ranges::iterator_t<OuterIterInput::value_type>; - -#endif // TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_LAZY_SPLIT_TYPES_H diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/arrow.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/arrow.pass.cpp deleted file mode 100644 index a676428..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/arrow.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// T* <copyable-box>::operator->() -// const T* <copyable-box>::operator->() const - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "types.h" - -template <class T> -constexpr void check() { - // non-const version - { - std::ranges::__movable_box<T> x(std::in_place, 10); - T* result = x.operator->(); - static_assert(noexcept(x.operator->())); - assert(result->value == 10); - assert(x->value == 10); - } - - // const version - { - std::ranges::__movable_box<T> const x(std::in_place, 10); - const T* result = x.operator->(); - static_assert(noexcept(x.operator->())); - assert(result->value == 10); - assert(x->value == 10); - } -} - -constexpr bool test() { - check<CopyConstructible>(); // primary template - check<Copyable>(); // optimization #1 - check<NothrowCopyConstructible>(); // optimization #2 - return true; -} - -int main(int, char**) { - assert(test()); - static_assert(test()); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/assign.copy.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/assign.copy.pass.cpp deleted file mode 100644 index 94c4dec..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/assign.copy.pass.cpp +++ /dev/null @@ -1,168 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <copyable-box>& operator=(<copyable-box> const&) - -// ADDITIONAL_COMPILE_FLAGS: -Wno-self-assign-overloaded - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "test_macros.h" -#include "types.h" - -constexpr bool test() { - // Test the primary template - { - using Box = std::ranges::__movable_box<CopyConstructible>; - static_assert(std::is_copy_assignable_v<Box>); - static_assert(!std::is_nothrow_copy_assignable_v<Box>); - - { - Box x(std::in_place, 5); - Box const y(std::in_place, 10); - Box& result = (x = y); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - } - // check self-assignment - { - Box x(std::in_place, 5); - Box& result = (x = x); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - } - } - - // Test optimization #1 for copy-assignment - { - using Box = std::ranges::__movable_box<Copyable>; - static_assert(std::is_copy_assignable_v<Box>); - static_assert(!std::is_nothrow_copy_assignable_v<Box>); - - { - Box x(std::in_place, 5); - Box const y(std::in_place, 10); - Box& result = (x = y); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - assert((*x).did_copy_assign); - } - // check self-assignment (should use the underlying type's assignment too) - { - Box x(std::in_place, 5); - Box& result = (x = x); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - assert((*x).did_copy_assign); - } - } - - // Test optimization #2 for copy-assignment - { - using Box = std::ranges::__movable_box<NothrowCopyConstructible>; - static_assert(std::is_copy_assignable_v<Box>); - static_assert(std::is_nothrow_copy_assignable_v<Box>); - - { - Box x(std::in_place, 5); - Box const y(std::in_place, 10); - Box& result = (x = y); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - } - // check self-assignment - { - Box x(std::in_place, 5); - Box& result = (x = x); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - } - } - - return true; -} - -// Tests for the empty state. Those can't be constexpr, since they are only reached -// through throwing an exception. -#if !defined(TEST_HAS_NO_EXCEPTIONS) -void test_empty_state() { - using Box = std::ranges::__movable_box<ThrowsOnCopy>; - - // assign non-empty to empty - { - Box x = create_empty_box(); - Box const y(std::in_place, 10); - Box& result = (x = y); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - } - // assign empty to non-empty - { - Box x(std::in_place, 5); - Box const y = create_empty_box(); - Box& result = (x = y); - - assert(&result == &x); - assert(!x.__has_value()); - assert(!y.__has_value()); - } - // assign empty to empty - { - Box x = create_empty_box(); - Box const y = create_empty_box(); - Box& result = (x = y); - - assert(&result == &x); - assert(!x.__has_value()); - assert(!y.__has_value()); - } - // check self-assignment in empty case - { - Box x = create_empty_box(); - Box& result = (x = x); - - assert(&result == &x); - assert(!x.__has_value()); - } -} -#endif // !defined(TEST_HAS_NO_EXCEPTIONS) - -int main(int, char**) { - assert(test()); - static_assert(test()); - -#if !defined(TEST_HAS_NO_EXCEPTIONS) - test_empty_state(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/assign.move.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/assign.move.pass.cpp deleted file mode 100644 index d4dc612..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/assign.move.pass.cpp +++ /dev/null @@ -1,228 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <copyable-box>& operator=(<copyable-box>&&) - -// ADDITIONAL_COMPILE_FLAGS: -Wno-self-move - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "test_macros.h" -#include "types.h" - -constexpr bool test() { - // Test the primary template - { - using Box = std::ranges::__movable_box<CopyConstructible>; - static_assert(std::is_move_assignable_v<Box>); - static_assert(!std::is_nothrow_move_assignable_v<Box>); - - { - Box x(std::in_place, 5); - Box y(std::in_place, 10); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - } - // check self-assignment - { - Box x(std::in_place, 5); - Box& result = (x = std::move(x)); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - } - } - - // Make sure that we use the native move assignment in the primary template if we can. - { - using Box = std::ranges::__movable_box<CopyConstructibleMovable>; - static_assert(std::is_move_assignable_v<Box>); - static_assert( - std::is_nothrow_move_assignable_v<Box> == std::is_nothrow_move_assignable_v<CopyConstructibleMovable>); - - { - Box x(std::in_place, 5); - Box y(std::in_place, 10); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - assert((*x).did_move_assign); - } - // check self-assignment - { - Box x(std::in_place, 5); - Box& result = (x = std::move(x)); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - assert((*x).did_move_assign); - } - } - - // Test optimization #1 for move assignment - { - using Box = std::ranges::__movable_box<Copyable>; - static_assert(std::is_move_assignable_v<Box>); - static_assert(!std::is_nothrow_move_assignable_v<Box>); - - { - Box x(std::in_place, 5); - Box y(std::in_place, 10); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - assert((*x).did_move_assign); - } - // check self-assignment (should use the underlying type's assignment too) - { - Box x(std::in_place, 5); - Box& result = (x = std::move(x)); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - assert((*x).did_move_assign); - } - } - - // Test optimization #1 for move assignment with a type that uses optimization #2 for copy assignment - { - using Box = std::ranges::__movable_box<MovableNothrowCopyConstructible>; - static_assert(std::is_move_assignable_v<Box>); - static_assert( - std::is_nothrow_move_assignable_v<Box> == std::is_nothrow_move_assignable_v<MovableNothrowCopyConstructible>); - - { - Box x(std::in_place, 5); - Box y(std::in_place, 10); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - assert((*x).did_move_assign); - } - // check self-assignment (should use the underlying type's assignment too) - { - Box x(std::in_place, 5); - Box& result = (x = std::move(x)); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - assert((*x).did_move_assign); - } - } - - // Test optimization #2 for move assignment - { - using Box = std::ranges::__movable_box<NothrowCopyConstructible>; - static_assert(std::is_move_assignable_v<Box>); - static_assert(std::is_nothrow_move_assignable_v<Box>); - - { - Box x(std::in_place, 5); - Box y(std::in_place, 10); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - } - // check self-assignment - { - Box x(std::in_place, 5); - Box& result = (x = std::move(x)); - - assert(&result == &x); - assert(x.__has_value()); - assert((*x).value == 5); - } - } - - return true; -} - -// Tests for the empty state. Those can't be constexpr, since they are only reached -// through throwing an exception. -#if !defined(TEST_HAS_NO_EXCEPTIONS) -void test_empty_state() { - using Box = std::ranges::__movable_box<ThrowsOnCopy>; - - // assign non-empty to empty - { - Box x = create_empty_box(); - Box y(std::in_place, 10); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(x.__has_value()); - assert(y.__has_value()); - assert((*x).value == 10); - } - // assign empty to non-empty - { - Box x(std::in_place, 5); - Box y = create_empty_box(); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(!x.__has_value()); - assert(!y.__has_value()); - } - // assign empty to empty - { - Box x = create_empty_box(); - Box y = create_empty_box(); - Box& result = (x = std::move(y)); - - assert(&result == &x); - assert(!x.__has_value()); - assert(!y.__has_value()); - } - // check self-assignment in empty case - { - Box x = create_empty_box(); - Box& result = (x = std::move(x)); - - assert(&result == &x); - assert(!x.__has_value()); - } -} -#endif // !defined(TEST_HAS_NO_EXCEPTIONS) - -int main(int, char**) { - assert(test()); - static_assert(test()); - -#if !defined(TEST_HAS_NO_EXCEPTIONS) - test_empty_state(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/ctor.default.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/ctor.default.pass.cpp deleted file mode 100644 index 3014dc0..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/ctor.default.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <copyable-box>::<copyable-box>() - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "types.h" - -template <class T> -using Box = std::ranges::__movable_box<T>; - -struct NoDefault { - NoDefault() = delete; -}; -static_assert(!std::is_default_constructible_v<Box<NoDefault>>); - -template <bool Noexcept> -struct DefaultNoexcept { - DefaultNoexcept() noexcept(Noexcept); -}; -static_assert(std::is_nothrow_default_constructible_v<Box<DefaultNoexcept<true>>>); -static_assert(!std::is_nothrow_default_constructible_v<Box<DefaultNoexcept<false>>>); - -constexpr bool test() { - // check primary template - { - Box<CopyConstructible> box; - assert(box.__has_value()); - assert((*box).value == CopyConstructible().value); - } - - // check optimization #1 - { - Box<Copyable> box; - assert(box.__has_value()); - assert((*box).value == Copyable().value); - } - - // check optimization #2 - { - Box<NothrowCopyConstructible> box; - assert(box.__has_value()); - assert((*box).value == NothrowCopyConstructible().value); - } - - return true; -} - -int main(int, char**) { - assert(test()); - static_assert(test()); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/ctor.in_place.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/ctor.in_place.pass.cpp deleted file mode 100644 index 6f97b7e..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/ctor.in_place.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class ...Args> -// explicit <copyable-box>::<copyable-box>(in_place_t, Args&& ...args); - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "types.h" - -struct UnknownType {}; - -template <bool Noexcept> -struct NothrowConstructible { - explicit NothrowConstructible(int) noexcept(Noexcept); -}; - -constexpr bool test() { - // Test the primary template - { - using Box = std::ranges::__movable_box<CopyConstructible>; - Box x(std::in_place, 5); - assert((*x).value == 5); - - static_assert(!std::is_constructible_v<Box, std::in_place_t, UnknownType>); - } - - // Test optimization #1 - { - using Box = std::ranges::__movable_box<Copyable>; - Box x(std::in_place, 5); - assert((*x).value == 5); - - static_assert(!std::is_constructible_v<Box, std::in_place_t, UnknownType>); - } - - // Test optimization #2 - { - using Box = std::ranges::__movable_box<NothrowCopyConstructible>; - Box x(std::in_place, 5); - assert((*x).value == 5); - - static_assert(!std::is_constructible_v<Box, std::in_place_t, UnknownType>); - } - - static_assert( - std::is_nothrow_constructible_v<std::ranges::__movable_box<NothrowConstructible<true>>, std::in_place_t, int>); - static_assert( - !std::is_nothrow_constructible_v<std::ranges::__movable_box<NothrowConstructible<false>>, std::in_place_t, int>); - - return true; -} - -int main(int, char**) { - assert(test()); - static_assert(test()); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/deref.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/deref.pass.cpp deleted file mode 100644 index 37734f0..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/deref.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// T& <copyable-box>::operator*() -// T const& <copyable-box>::operator*() const - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "types.h" - -template <class T> -constexpr void check() { - // non-const version - { - std::ranges::__movable_box<T> x(std::in_place, 10); - T& result = *x; - static_assert(noexcept(*x)); - assert(result.value == 10); - } - - // const version - { - std::ranges::__movable_box<T> const x(std::in_place, 10); - T const& result = *x; - static_assert(noexcept(*x)); - assert(result.value == 10); - } -} - -constexpr bool test() { - check<CopyConstructible>(); // primary template - check<Copyable>(); // optimization #1 - check<NothrowCopyConstructible>(); // optimization #2 - return true; -} - -int main(int, char**) { - assert(test()); - static_assert(test()); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/empty_object.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/empty_object.pass.cpp deleted file mode 100644 index 9712635..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/empty_object.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// This test ensures that <movable-box> behaves correctly when it holds an empty type. - -#include <ranges> - -#include <cassert> -#include <utility> - -bool copied = false; -bool moved = false; - -struct Empty { - Empty() noexcept {} - Empty(Empty const&) noexcept { copied = true; } - Empty(Empty&&) noexcept { moved = true; } - Empty& operator=(Empty const&) = delete; - Empty& operator=(Empty&&) = delete; -}; - -using Box = std::ranges::__movable_box<Empty>; - -struct Inherit : Box {}; - -struct Hold : Box { - [[no_unique_address]] Inherit member; -}; - -int main(int, char**) { - Hold box; - - Box& base = static_cast<Box&>(box); - Box& member = static_cast<Box&>(box.member); - - // Despite [[no_unique_address]], the two objects have the same type so they - // can't share the same address. - assert(&base != &member); - - // Make sure that we do perform the copy-construction, which wouldn't be the - // case if the two <movable-box>s had the same address. - base = member; - assert(copied); - - base = std::move(member); - assert(moved); - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/has_value.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/has_value.pass.cpp deleted file mode 100644 index 397e638..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/has_value.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// bool <copyable-box>::__has_value() const - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> // in_place_t - -#include "types.h" - -template <class T> -constexpr void check() { - std::ranges::__movable_box<T> const x(std::in_place, 10); - assert(x.__has_value()); -} - -constexpr bool test() { - check<CopyConstructible>(); // primary template - check<Copyable>(); // optimization #1 - check<NothrowCopyConstructible>(); // optimization #2 - return true; -} - -int main(int, char**) { - assert(test()); - static_assert(test()); - - // Tests for the empty state. Those can't be constexpr, since they are only reached - // through throwing an exception. -#if !defined(TEST_HAS_NO_EXCEPTIONS) - { - std::ranges::__movable_box<ThrowsOnCopy> x = create_empty_box(); - assert(!x.__has_value()); - } -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/no_unique_address.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/no_unique_address.pass.cpp deleted file mode 100644 index 4ec6c88..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/no_unique_address.pass.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// clang-cl and cl currently don't support [[no_unique_address]] -// XFAIL: msvc - -#include <ranges> - -#include <cassert> -#include <utility> - -#include "test_macros.h" - -template <class T, bool ExpectNoUniqueAddress> -void test_no_unique_address() { - struct Test { - [[no_unique_address]] std::ranges::__movable_box<T> box_; - bool b2; - }; - - if constexpr (ExpectNoUniqueAddress) { - static_assert(sizeof(Test) == sizeof(bool)); - } else { - static_assert(sizeof(Test) > sizeof(bool)); - } -} - -struct Copyable {}; - -struct NotCopyAssignable { - constexpr NotCopyAssignable() = default; - constexpr NotCopyAssignable(const NotCopyAssignable&) = default; - NotCopyAssignable& operator=(const NotCopyAssignable&) = delete; -}; - -struct NotMoveAssignable { - constexpr NotMoveAssignable() = default; - constexpr NotMoveAssignable(const NotMoveAssignable&) = default; - NotMoveAssignable& operator=(const NotMoveAssignable&) = default; - constexpr NotMoveAssignable(NotMoveAssignable&&) = default; - NotMoveAssignable& operator=(NotMoveAssignable&&) = delete; -}; - -struct MoveOnly { - constexpr MoveOnly() = default; - constexpr MoveOnly(const MoveOnly&) = delete; - MoveOnly& operator=(const MoveOnly&) = delete; - constexpr MoveOnly(MoveOnly&&) = default; - MoveOnly& operator=(MoveOnly&&) = default; -}; - -struct MoveOnlyNotAssignable { - constexpr MoveOnlyNotAssignable() = default; - constexpr MoveOnlyNotAssignable(const MoveOnlyNotAssignable&) = delete; - MoveOnlyNotAssignable& operator=(const MoveOnlyNotAssignable&) = delete; - constexpr MoveOnlyNotAssignable(MoveOnlyNotAssignable&&) = default; - MoveOnlyNotAssignable& operator=(MoveOnlyNotAssignable&&) = delete; -}; - -int main(int, char**) { - test_no_unique_address<Copyable, true>(); - test_no_unique_address<NotCopyAssignable, false>(); - test_no_unique_address<NotMoveAssignable, false>(); - -#if TEST_STD_VER >= 23 - test_no_unique_address<MoveOnly, true>(); - test_no_unique_address<MoveOnlyNotAssignable, false>(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/properties.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/properties.compile.pass.cpp deleted file mode 100644 index 6596c70..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/properties.compile.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test various properties of <copyable-box> - -#include <ranges> - -#include <optional> - -#include "MoveOnly.h" - -#include "types.h" - -template <class T> -constexpr bool valid_movable_box = requires { typename std::ranges::__movable_box<T>; }; - -struct NotCopyConstructible { - NotCopyConstructible() = default; - NotCopyConstructible(NotCopyConstructible&&) = default; - NotCopyConstructible(NotCopyConstructible const&) = delete; - NotCopyConstructible& operator=(NotCopyConstructible&&) = default; - NotCopyConstructible& operator=(NotCopyConstructible const&) = default; -}; - -static_assert(!valid_movable_box<void>); // not an object type -static_assert(!valid_movable_box<int&>); // not an object type - -#if _LIBCPP_STD_VER >= 23 -struct NotCopyConstructibleNotMoveConstructible { - NotCopyConstructibleNotMoveConstructible() = default; - NotCopyConstructibleNotMoveConstructible(NotCopyConstructibleNotMoveConstructible&&) = delete; - NotCopyConstructibleNotMoveConstructible(NotCopyConstructibleNotMoveConstructible const&) = delete; - NotCopyConstructibleNotMoveConstructible& operator=(NotCopyConstructibleNotMoveConstructible&&) = delete; - NotCopyConstructibleNotMoveConstructible& operator=(NotCopyConstructibleNotMoveConstructible const&) = delete; -}; - -// [P2494R2] Relaxing range adaptors to allow for move only types. -static_assert(!valid_movable_box<NotCopyConstructibleNotMoveConstructible>); -static_assert(valid_movable_box<NotCopyConstructible>); -static_assert(valid_movable_box<MoveOnly>); -#else -static_assert(!valid_movable_box<NotCopyConstructible>); -#endif - -// primary template -static_assert(sizeof(std::ranges::__movable_box<CopyConstructible>) == sizeof(std::optional<CopyConstructible>)); - -// optimization #1 -static_assert(sizeof(std::ranges::__movable_box<Copyable>) == sizeof(Copyable)); -static_assert(alignof(std::ranges::__movable_box<Copyable>) == alignof(Copyable)); - -// optimization #2 -static_assert(sizeof(std::ranges::__movable_box<NothrowCopyConstructible>) == sizeof(NothrowCopyConstructible)); -static_assert(alignof(std::ranges::__movable_box<NothrowCopyConstructible>) == alignof(NothrowCopyConstructible)); diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/types.h b/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/types.h deleted file mode 100644 index 9e6bf5d..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.move.wrap/types.h +++ /dev/null @@ -1,157 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_COPY_WRAP_TYPES_H -#define TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_COPY_WRAP_TYPES_H - -#include <ranges> -#include <cassert> -#include <concepts> -#include <type_traits> - -#include "test_macros.h" - -// NOTE: These types are strongly tied to the implementation of __movable_box. See the documentation -// in __movable_box for the meaning of optimizations #1 and #2. - -// Copy constructible, but neither copyable nor nothrow_copy/move_constructible. This uses the primary template. -struct CopyConstructible { - constexpr CopyConstructible() = default; - constexpr explicit CopyConstructible(int x) : value(x) {} - CopyConstructible(CopyConstructible const&) noexcept(false) = default; - CopyConstructible& operator=(CopyConstructible const&) = delete; - - int value = -1; -}; -static_assert(!std::copyable<CopyConstructible>); -static_assert(!std::is_nothrow_copy_constructible_v<CopyConstructible>); -static_assert(!std::movable<CopyConstructible>); -static_assert(!std::is_nothrow_move_constructible_v<CopyConstructible>); - -// Copy constructible and movable, but not copyable. This uses the primary template, however we're -// still able to use the native move-assignment operator in this case. -struct CopyConstructibleMovable { - constexpr CopyConstructibleMovable() = default; - constexpr explicit CopyConstructibleMovable(int x) : value(x) {} - CopyConstructibleMovable(CopyConstructibleMovable const&) noexcept(false) = default; - CopyConstructibleMovable(CopyConstructibleMovable&&) noexcept(false) = default; - CopyConstructibleMovable& operator=(CopyConstructibleMovable const&) = delete; - - constexpr CopyConstructibleMovable& operator=(CopyConstructibleMovable&& other) { - value = other.value; - did_move_assign = true; - return *this; - } - - int value = -1; - bool did_move_assign = false; -}; - -// Copyable type that is not nothrow_copy/move_constructible. -// This triggers optimization #1 for the copy assignment and the move assignment. -struct Copyable { - constexpr Copyable() = default; - constexpr explicit Copyable(int x) : value(x) {} - Copyable(Copyable const&) noexcept(false) = default; - - constexpr Copyable& operator=(Copyable const& other) noexcept(false) { - value = other.value; - did_copy_assign = true; - return *this; - } - - constexpr Copyable& operator=(Copyable&& other) noexcept(false) { - value = other.value; - did_move_assign = true; - return *this; - } - - int value = -1; - bool did_copy_assign = false; - bool did_move_assign = false; -}; -static_assert(std::copyable<Copyable>); -static_assert(!std::is_nothrow_copy_constructible_v<Copyable>); -static_assert(std::movable<Copyable>); -static_assert(!std::is_nothrow_move_constructible_v<Copyable>); - -// Non-copyable type that is nothrow_copy_constructible and nothrow_move_constructible. -// This triggers optimization #2 for the copy assignment and the move assignment. -struct NothrowCopyConstructible { - constexpr NothrowCopyConstructible() = default; - constexpr explicit NothrowCopyConstructible(int x) : value(x) {} - NothrowCopyConstructible(NothrowCopyConstructible const&) noexcept = default; - NothrowCopyConstructible(NothrowCopyConstructible&&) noexcept = default; - NothrowCopyConstructible& operator=(NothrowCopyConstructible const&) = delete; - - int value = -1; -}; -static_assert(!std::copyable<NothrowCopyConstructible>); -static_assert(std::is_nothrow_copy_constructible_v<NothrowCopyConstructible>); -static_assert(!std::movable<NothrowCopyConstructible>); -static_assert(std::is_nothrow_move_constructible_v<NothrowCopyConstructible>); - -// Non-copyable type that is nothrow_copy_constructible, and that is movable but NOT nothrow_move_constructible. -// This triggers optimization #2 for the copy assignment, and optimization #1 for the move assignment. -struct MovableNothrowCopyConstructible { - constexpr MovableNothrowCopyConstructible() = default; - constexpr explicit MovableNothrowCopyConstructible(int x) : value(x) {} - MovableNothrowCopyConstructible(MovableNothrowCopyConstructible const&) noexcept = default; - MovableNothrowCopyConstructible(MovableNothrowCopyConstructible&&) noexcept(false) = default; - constexpr MovableNothrowCopyConstructible& operator=(MovableNothrowCopyConstructible&& other) { - value = other.value; - did_move_assign = true; - return *this; - } - - int value = -1; - bool did_move_assign = false; -}; -static_assert(!std::copyable<MovableNothrowCopyConstructible>); -static_assert(std::is_nothrow_copy_constructible_v<MovableNothrowCopyConstructible>); -static_assert(std::movable<MovableNothrowCopyConstructible>); -static_assert(!std::is_nothrow_move_constructible_v<MovableNothrowCopyConstructible>); - -#if !defined(TEST_HAS_NO_EXCEPTIONS) -// A type that we can make throw when copied from. This is used to create a -// copyable-box in the empty state. -static constexpr int THROW_WHEN_COPIED_FROM = 999; -struct ThrowsOnCopy { - constexpr ThrowsOnCopy() = default; - constexpr explicit ThrowsOnCopy(int x) : value(x) {} - ThrowsOnCopy(ThrowsOnCopy const& other) { - if (other.value == THROW_WHEN_COPIED_FROM) - throw 0; - else - value = other.value; - } - - ThrowsOnCopy& operator=(ThrowsOnCopy const&) = delete; // prevent from being copyable - - int value = -1; -}; - -// Creates an empty box. The only way to do that is to try assigning one box -// to another and have that fail due to an exception when calling the copy -// constructor. The assigned-to box will then be in the empty state. -inline std::ranges::__movable_box<ThrowsOnCopy> create_empty_box() { - std::ranges::__movable_box<ThrowsOnCopy> box1; - std::ranges::__movable_box<ThrowsOnCopy> box2(std::in_place, THROW_WHEN_COPIED_FROM); - try { - box1 = box2; // throws during assignment, which is implemented as a call to the copy ctor - } catch (...) { - // now, box1 is empty - assert(!box1.__has_value()); - return box1; - } - assert(false && "should never be reached"); - return box1; // to silence warning about missing return in non-void function -} -#endif // !defined(TEST_HAS_NO_EXCEPTIONS) - -#endif // TEST_LIBCXX_RANGES_RANGE_ADAPTORS_RANGE_COPY_WRAP_TYPES_H diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.reverse/adaptor.nodiscard.verify.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.reverse/adaptor.nodiscard.verify.cpp deleted file mode 100644 index 2f7eb94..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.reverse/adaptor.nodiscard.verify.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++ extension that std::views::reverse is marked as [[nodiscard]]. - -#include <ranges> - -void test() { - int range[] = {1, 2, 3}; - - std::views::reverse(range); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::views::reverse; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::all | std::views::reverse; // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp deleted file mode 100644 index 7950827..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// class split_view { -// _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); -// _LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern(); -// }; - -#include <ranges> - -#include "test_iterators.h" - -struct EmptyView : std::ranges::view_base { - int* begin() const; - int* end() const; -}; - -using SplitView = std::ranges::split_view<EmptyView, EmptyView>; -static_assert(sizeof(SplitView) == sizeof(std::ranges::__non_propagating_cache<std::ranges::subrange<int*>>)); diff --git a/libcxx/test/libcxx-03/ranges/range.adaptors/range.transform/adaptor.nodiscard.verify.cpp b/libcxx/test/libcxx-03/ranges/range.adaptors/range.transform/adaptor.nodiscard.verify.cpp deleted file mode 100644 index 0a5fbf7..0000000 --- a/libcxx/test/libcxx-03/ranges/range.adaptors/range.transform/adaptor.nodiscard.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++ extension that std::views::transform is marked as [[nodiscard]]. - -#include <ranges> - -void test() { - int range[] = {1, 2, 3}; - auto f = [](int i) { return i; }; - - std::views::transform(f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::transform(range, f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - range | std::views::transform(f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - std::views::all | std::views::transform(f); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp deleted file mode 100644 index 56d973d..0000000 --- a/libcxx/test/libcxx-03/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: no-localization -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Test the libc++ extension that the value stored in `std::ranges::istream_view` has been marked -// as _LIBCPP_NO_UNIQUE_ADDRESS - -#include <istream> -#include <ranges> - -struct Empty { - friend std::istream& operator>>(std::istream& i, Empty const&) { return i; } -}; - -static_assert(sizeof(std::ranges::istream_view<Empty>) == sizeof(void*)); diff --git a/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp b/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp deleted file mode 100644 index 6d4e541..0000000 --- a/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/ctor.piecewise.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// REQUIRES: has-unix-headers -// XFAIL: availability-verbose_abort-missing - -// template<class... TArgs, class... BoundArgs> -// requires constructible_from<T, TArgs...> && -// constructible_from<Bound, BoundArgs...> -// constexpr explicit repeat_view(piecewise_construct_t, -// tuple<TArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{}); - -#include <ranges> -#include <tuple> - -#include "check_assertion.h" - -// clang-format off -int main(int, char**) { - using Repeat = std::ranges::repeat_view<int, int>; - TEST_LIBCPP_ASSERT_FAILURE(Repeat(std::piecewise_construct, std::tuple{1}, std::tuple{-1}), "The behavior is undefined if Bound is not unreachable_sentinel_t and bound is negative"); - - return 0; -} -// clang-format on diff --git a/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp b/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp deleted file mode 100644 index 2e9c74b..0000000 --- a/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/ctor.value.bound.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// REQUIRES: has-unix-headers -// XFAIL: availability-verbose_abort-missing - -// constexpr explicit repeat_view(W&& value, Bound bound = Bound()); -// constexpr explicit repeat_view(const W& value, Bound bound = Bound()); - -#include <ranges> - -#include "check_assertion.h" - -// clang-format off -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::repeat_view(0, -1), "The value of bound must be greater than or equal to 0"); - const int val = 0; - TEST_LIBCPP_ASSERT_FAILURE(std::ranges::repeat_view(val, -1), "The value of bound must be greater than or equal to 0"); - - return 0; -} -// clang-format on diff --git a/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/no_unique_address.compile.pass.cpp deleted file mode 100644 index 6ab2ee1..0000000 --- a/libcxx/test/libcxx-03/ranges/range.factories/range.repeat.view/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// XFAIL: msvc - -// This test ensures that we use `[[no_unique_address]]` in `repeat_view`. - -#include <ranges> - -struct Empty {}; - -struct Test { - [[no_unique_address]] std::ranges::repeat_view<Empty> v; - bool b; -}; - -static_assert(sizeof(Test) == sizeof(bool)); diff --git a/libcxx/test/libcxx-03/ranges/range.factories/range.single.view/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.factories/range.single.view/no_unique_address.compile.pass.cpp deleted file mode 100644 index 10883b8..0000000 --- a/libcxx/test/libcxx-03/ranges/range.factories/range.single.view/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: msvc - -// This test ensures that we use `[[no_unique_address]]` in `single_view`. - -#include <ranges> - -struct Empty {}; - -struct Test { - [[no_unique_address]] std::ranges::single_view<Empty> v; - bool b; -}; - -static_assert(sizeof(Test) == sizeof(bool)); diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/assign.copy.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/assign.copy.pass.cpp deleted file mode 100644 index 598aeb3..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/assign.copy.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// __non_propagating_cache& operator=(__non_propagating_cache const&); - -// ADDITIONAL_COMPILE_FLAGS: -Wno-self-assign - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> - -template<bool NoexceptCopy> -struct CopyAssignable { - int x; - constexpr explicit CopyAssignable(int i) : x(i) { } - CopyAssignable(CopyAssignable const&) = default; - constexpr CopyAssignable& operator=(CopyAssignable const& other) noexcept(NoexceptCopy) { - x = other.x; - return *this; - } - constexpr bool operator==(CopyAssignable const& other) const { return x == other.x; } -}; - -struct NotCopyAssignable { - int x; - constexpr explicit NotCopyAssignable(int i) : x(i) { } - NotCopyAssignable(NotCopyAssignable const&) = default; - NotCopyAssignable& operator=(NotCopyAssignable const&) = delete; - constexpr bool operator==(NotCopyAssignable const& other) const { return x == other.x; } -}; - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - static_assert(std::is_nothrow_copy_assignable_v<Cache>); - - // Assign to an empty cache - { - Cache a; a.__emplace(3); - Cache b; - - Cache& result = (b = a); - assert(&result == &b); - assert(!b.__has_value()); // make sure we don't propagate - - assert(a.__has_value()); // make sure we don't "steal" from the source - assert(*a == T{3}); // - } - - // Assign to a non-empty cache - { - Cache a; a.__emplace(3); - Cache b; b.__emplace(5); - - Cache& result = (b = a); - assert(&result == &b); - assert(!b.__has_value()); // make sure we don't propagate - - assert(a.__has_value()); // make sure we don't "steal" from the source - assert(*a == T{3}); // - } - - // Self-assignment should not do anything (case with empty cache) - { - Cache b; - Cache& result = (b = b); - assert(&result == &b); - assert(!b.__has_value()); - } - - // Self-assignment should not do anything (case with non-empty cache) - { - Cache b; b.__emplace(5); - Cache& result = (b = b); - assert(&result == &b); - assert(b.__has_value()); - assert(*b == T{5}); - } -} - -constexpr bool tests() { - test<CopyAssignable<true>>(); - test<CopyAssignable<false>>(); - test<NotCopyAssignable>(); - test<int>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/assign.move.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/assign.move.pass.cpp deleted file mode 100644 index 84fc092..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/assign.move.pass.cpp +++ /dev/null @@ -1,98 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// __non_propagating_cache& operator=(__non_propagating_cache&&); - -// ADDITIONAL_COMPILE_FLAGS: -Wno-self-assign - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> - -template<bool NoexceptMove> -struct MoveAssignable { - int x; - constexpr explicit MoveAssignable(int i) : x(i) { } - MoveAssignable(MoveAssignable&&) = default; - constexpr MoveAssignable& operator=(MoveAssignable&& other) noexcept(NoexceptMove) { - x = other.x; - other.x = -1; - return *this; - } -}; - -struct NotMoveAssignable { - int x; - constexpr explicit NotMoveAssignable(int i) : x(i) { } - NotMoveAssignable(NotMoveAssignable&&) = default; - NotMoveAssignable& operator=(NotMoveAssignable&&) = delete; -}; - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - static_assert(std::is_nothrow_move_assignable_v<Cache>); - - // Assign to an empty cache - { - Cache a; a.__emplace(3); - Cache b; - - Cache& result = (b = std::move(a)); - assert(&result == &b); - assert(!b.__has_value()); // make sure we don't propagate - assert(!a.__has_value()); // make sure we disengage the source - } - - // Assign to a non-empty cache - { - Cache a; a.__emplace(3); - Cache b; b.__emplace(5); - - Cache& result = (b = std::move(a)); - assert(&result == &b); - assert(!b.__has_value()); // make sure we don't propagate - assert(!a.__has_value()); // make sure we disengage the source - } - - // Self-assignment should clear the cache (case with empty cache) - { - Cache b; - - Cache& result = (b = std::move(b)); - assert(&result == &b); - assert(!b.__has_value()); - } - - // Self-assignment should clear the cache (case with non-empty cache) - { - Cache b; b.__emplace(5); - - Cache& result = (b = std::move(b)); - assert(&result == &b); - assert(!b.__has_value()); - } -} - -constexpr bool tests() { - test<MoveAssignable<true>>(); - test<MoveAssignable<false>>(); - test<NotMoveAssignable>(); - test<int>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/constraints.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/constraints.compile.pass.cpp deleted file mode 100644 index 407b9df..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/constraints.compile.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class T> -// requires is_object_v<T> -// class non-propagating-cache; - -#include <ranges> - -template<template<class...> class T, class ...Args> -concept well_formed = requires { - typename T<Args...>; -}; - -struct T { }; -static_assert( well_formed<std::ranges::__non_propagating_cache, int>); -static_assert( well_formed<std::ranges::__non_propagating_cache, T>); -static_assert( well_formed<std::ranges::__non_propagating_cache, void (*)()>); -static_assert(!well_formed<std::ranges::__non_propagating_cache, void>); -static_assert(!well_formed<std::ranges::__non_propagating_cache, T&>); -static_assert(!well_formed<std::ranges::__non_propagating_cache, void()>); diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.copy.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.copy.pass.cpp deleted file mode 100644 index e20c32d..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.copy.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// __non_propagating_cache(__non_propagating_cache const&); - -#include <ranges> - -#include <cassert> -#include <type_traits> - -template<bool NoexceptCopy> -struct CopyConstructible { - int x; - constexpr explicit CopyConstructible(int i) : x(i) { } - constexpr CopyConstructible(CopyConstructible const& other) noexcept(NoexceptCopy) : x(other.x) { } - CopyConstructible& operator=(CopyConstructible const&) = default; - constexpr bool operator==(CopyConstructible const& other) const { return x == other.x; } -}; - -struct NotCopyConstructible { - int x; - constexpr explicit NotCopyConstructible(int i) : x(i) { } - NotCopyConstructible(NotCopyConstructible const&) = delete; - NotCopyConstructible(NotCopyConstructible&&) = default; - constexpr bool operator==(NotCopyConstructible const& other) const { return x == other.x; } -}; - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - static_assert(std::is_nothrow_copy_constructible_v<Cache>); - Cache a; - a.__emplace(3); - - // Test with direct initialization - { - Cache b(a); - assert(!b.__has_value()); // make sure we don't propagate - - assert(a.__has_value()); // make sure we don't "steal" from the source - assert(*a == T{3}); // - } - - // Test with copy initialization - { - Cache b = a; - assert(!b.__has_value()); // make sure we don't propagate - - assert(a.__has_value()); // make sure we don't "steal" from the source - assert(*a == T{3}); // - } -} - -constexpr bool tests() { - test<CopyConstructible<true>>(); - test<CopyConstructible<false>>(); - test<NotCopyConstructible>(); - test<int>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.default.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.default.pass.cpp deleted file mode 100644 index 109e487..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.default.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// __non_propagating_cache(); - -#include <ranges> - -#include <cassert> -#include <type_traits> - -struct HasDefault { HasDefault() = default; }; -struct NoDefault { NoDefault() = delete; }; - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - static_assert(std::is_nothrow_default_constructible_v<Cache>); - Cache cache; - assert(!cache.__has_value()); -} - -constexpr bool tests() { - test<HasDefault>(); - test<NoDefault>(); - test<int>(); - test<char*>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.move.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.move.pass.cpp deleted file mode 100644 index 6070130..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/ctor.move.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// __non_propagating_cache(__non_propagating_cache&&); - -#include <ranges> - -#include <cassert> -#include <type_traits> -#include <utility> - -template<bool NoexceptMove> -struct MoveConstructible { - int x; - constexpr explicit MoveConstructible(int i) : x(i) { } - constexpr MoveConstructible(MoveConstructible&& other) noexcept(NoexceptMove) : x(other.x) { other.x = -1; } - MoveConstructible& operator=(MoveConstructible&&) = default; -}; - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - static_assert(std::is_nothrow_move_constructible_v<Cache>); - - // Test with direct initialization - { - Cache a; - a.__emplace(3); - - Cache b(std::move(a)); - assert(!b.__has_value()); // make sure we don't propagate - assert(!a.__has_value()); // make sure we disengage the source - } - - // Test with copy initialization - { - Cache a; - a.__emplace(3); - - Cache b = std::move(a); - assert(!b.__has_value()); // make sure we don't propagate - assert(!a.__has_value()); // make sure we disengage the source - } -} - -constexpr bool tests() { - test<MoveConstructible<true>>(); - test<MoveConstructible<false>>(); - test<int>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/deref.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/deref.pass.cpp deleted file mode 100644 index 3a07516..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/deref.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// constexpr T const& operator*() const; -// constexpr T& operator*(); - -#include <ranges> - -#include <cassert> - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - - // non-const version - { - Cache cache; cache.__emplace(3); - T& result = *cache; - assert(result == T{3}); - } - - // const version - { - Cache cache; cache.__emplace(3); - T const& result = *static_cast<Cache const&>(cache); - assert(result == T{3}); - } -} - -struct T { - int x; - constexpr explicit T(int i) : x(i) { } - constexpr bool operator==(T const& other) const { return x == other.x; } -}; - -constexpr bool tests() { - test<T>(); - test<int>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/emplace.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/emplace.pass.cpp deleted file mode 100644 index c94fea6..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/emplace.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class ...Args> -// constexpr T& __emplace(Args&& ...); - -#include <ranges> - -#include <cassert> -#include <tuple> - -template<int I> -struct X { - int value = -1; - template<int J> - friend constexpr bool operator==(X const& a, X<J> const& b) { return I == J && a.value == b.value; } -}; - -struct NonMovable { - int value = -1; - NonMovable() = default; - constexpr explicit NonMovable(int v) : value(v) { } - NonMovable(NonMovable&&) = delete; - NonMovable& operator=(NonMovable&&) = delete; -}; - -constexpr bool test() { - { - using T = std::tuple<>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace(); - assert(&result == &*cache); - assert(result == T()); - } - - { - using T = std::tuple<X<0>>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace(); - assert(&result == &*cache); - assert(result == T()); - } - { - using T = std::tuple<X<0>>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace(X<0>{0}); - assert(&result == &*cache); - assert(result == T(X<0>{0})); - } - - { - using T = std::tuple<X<0>, X<1>>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace(); - assert(&result == &*cache); - assert(result == T()); - } - { - using T = std::tuple<X<0>, X<1>>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace(X<0>{0}, X<1>{1}); - assert(&result == &*cache); - assert(result == T(X<0>{0}, X<1>{1})); - } - - // Make sure that we do not require the type to be movable when we emplace it. - // Move elision should be performed instead, see http://eel.is/c++draft/range.nonprop.cache#note-1. - { - using Cache = std::ranges::__non_propagating_cache<NonMovable>; - Cache cache; - NonMovable& result = cache.__emplace(); - assert(&result == &*cache); - assert(result.value == -1); - } - - return true; -} - -int main(int, char**) { - static_assert(test()); - test(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/emplace_from.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/emplace_from.pass.cpp deleted file mode 100644 index d097be3..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/emplace_from.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<class Fn> -// constexpr T& __emplace_from(Fn const&); - -#include <ranges> - -#include <cassert> -#include <tuple> - -template<int I> -struct X { - int value = -1; - template<int J> - friend constexpr bool operator==(X const& a, X<J> const& b) { return I == J && a.value == b.value; } -}; - -struct NonMovable { - int value = -1; - NonMovable() = default; - constexpr explicit NonMovable(int v) : value(v) { } - NonMovable(NonMovable&&) = delete; - NonMovable& operator=(NonMovable&&) = delete; -}; - -constexpr bool test() { - { - using T = std::tuple<>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace_from([] { return T(); }); - assert(&result == &*cache); - assert(result == T()); - } - { - using T = std::tuple<X<0>>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace_from([] { return T(X<0>{0}); }); - assert(&result == &*cache); - assert(result == T(X<0>{0})); - } - { - using T = std::tuple<X<0>, X<1>>; - using Cache = std::ranges::__non_propagating_cache<T>; - Cache cache; - T& result = cache.__emplace_from([] { return T(X<0>{0}, X<1>{1}); }); - assert(&result == &*cache); - assert(result == T(X<0>{0}, X<1>{1})); - } - - // Make sure that we do not require the type to be movable when we emplace it. - // Move elision should be performed instead, see http://eel.is/c++draft/range.nonprop.cache#note-1. - { - using Cache = std::ranges::__non_propagating_cache<NonMovable>; - Cache cache; - NonMovable& result = cache.__emplace_from([] { return NonMovable(3); }); - assert(&result == &*cache); - assert(result.value == 3); - } - - return true; -} - -int main(int, char**) { - static_assert(test()); - test(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/has_value.pass.cpp b/libcxx/test/libcxx-03/ranges/range.nonprop.cache/has_value.pass.cpp deleted file mode 100644 index e273062..0000000 --- a/libcxx/test/libcxx-03/ranges/range.nonprop.cache/has_value.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// constexpr bool __has_value() const; - -#include <ranges> - -#include <cassert> - -template <class T> -constexpr void test() { - using Cache = std::ranges::__non_propagating_cache<T>; - - // __has_value on an empty cache - { - Cache const cache; - assert(!cache.__has_value()); - } - - // __has_value on a non-empty cache - { - Cache cache; cache.__emplace(); - assert(cache.__has_value()); - } -} - -struct T { }; - -constexpr bool tests() { - test<T>(); - test<int>(); - return true; -} - -int main(int, char**) { - static_assert(tests()); - tests(); - return 0; -} diff --git a/libcxx/test/libcxx-03/ranges/range.utility.helpers/different_from.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.utility.helpers/different_from.compile.pass.cpp deleted file mode 100644 index 26f6a771..0000000 --- a/libcxx/test/libcxx-03/ranges/range.utility.helpers/different_from.compile.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <ranges> - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Check that different_from.h is self-contained - -#include <__concepts/different_from.h> - -static_assert(std::__different_from<int, char>); -static_assert(std::__different_from<const int, char>); -static_assert(!std::__different_from<const int, int>); -static_assert(!std::__different_from<const volatile int, int>); -static_assert(!std::__different_from<const int&, int>); -static_assert(!std::__different_from<int&, int>); -static_assert(!std::__different_from<int&&, int>); -static_assert(!std::__different_from<int, int&>); -static_assert(!std::__different_from<int&, const int&>); -static_assert(!std::__different_from<int(&)(), int()>); -static_assert(std::__different_from<int(&)(), int(*)()>); diff --git a/libcxx/test/libcxx-03/ranges/range.utility.helpers/has_arrow.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.utility.helpers/has_arrow.compile.pass.cpp deleted file mode 100644 index 4f246f4..0000000 --- a/libcxx/test/libcxx-03/ranges/range.utility.helpers/has_arrow.compile.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <ranges> - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <cstddef> -#include <iterator> - -#include "test_macros.h" - -struct simple_iter { - typedef std::input_iterator_tag iterator_category; - typedef int value_type; - typedef std::ptrdiff_t difference_type; - typedef int* pointer; - typedef int& reference; - - reference operator*() const; - pointer operator->() const; - friend bool operator==(const simple_iter&, const simple_iter&); - friend bool operator< (const simple_iter&, const simple_iter&); - friend bool operator<=(const simple_iter&, const simple_iter&); - friend bool operator> (const simple_iter&, const simple_iter&); - friend bool operator>=(const simple_iter&, const simple_iter&); - - simple_iter& operator++(); - simple_iter operator++(int); -}; - -struct no_star { - typedef std::input_iterator_tag iterator_category; - typedef int value_type; - typedef std::ptrdiff_t difference_type; - typedef int* pointer; - typedef int& reference; - - /* reference operator*() const; */ - pointer operator->() const; - friend bool operator==(const simple_iter&, const simple_iter&); - friend bool operator< (const simple_iter&, const simple_iter&); - friend bool operator<=(const simple_iter&, const simple_iter&); - friend bool operator> (const simple_iter&, const simple_iter&); - friend bool operator>=(const simple_iter&, const simple_iter&); - - simple_iter& operator++(); - simple_iter operator++(int); -}; - -struct no_arrow { - typedef std::input_iterator_tag iterator_category; - typedef int value_type; - typedef std::ptrdiff_t difference_type; - typedef int* pointer; - typedef int& reference; - - reference operator*() const; - /* pointer operator->() const; */ - friend bool operator==(const simple_iter&, const simple_iter&); - friend bool operator< (const simple_iter&, const simple_iter&); - friend bool operator<=(const simple_iter&, const simple_iter&); - friend bool operator> (const simple_iter&, const simple_iter&); - friend bool operator>=(const simple_iter&, const simple_iter&); - - simple_iter& operator++(); - simple_iter operator++(int); -}; - -struct E {}; -struct Incomplete; - -static_assert(std::__has_arrow<int*>); -static_assert(std::__has_arrow<E*>); -static_assert(!std::__has_arrow<Incomplete*>); // Because it's not an input_iterator. -static_assert(std::__has_arrow<simple_iter>); -static_assert(!std::__has_arrow<no_star>); -static_assert(!std::__has_arrow<no_arrow>); diff --git a/libcxx/test/libcxx-03/ranges/range.utility.helpers/simple_view.compile.pass.cpp b/libcxx/test/libcxx-03/ranges/range.utility.helpers/simple_view.compile.pass.cpp deleted file mode 100644 index 440b12e..0000000 --- a/libcxx/test/libcxx-03/ranges/range.utility.helpers/simple_view.compile.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <ranges> - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -#include <ranges> - -#include "test_macros.h" -#include "test_iterators.h" -#include "test_range.h" - -struct SimpleView : std::ranges::view_base { - int *begin() const; - int *end() const; -}; - -struct WrongConstView : std::ranges::view_base { - int *begin(); - const int *begin() const; - int *end(); - const int *end() const; -}; - -struct NoConstView : std::ranges::view_base { - int *begin(); - int *end(); -}; - -struct DifferentSentinel : std::ranges::view_base { - int *begin() const; - sentinel_wrapper<int*> end() const; -}; - -struct WrongConstSentinel : std::ranges::view_base { - int *begin() const; - sentinel_wrapper<int*> end(); - sentinel_wrapper<const int*> end() const; -}; - -static_assert( std::ranges::__simple_view<SimpleView>); -static_assert(!std::ranges::__simple_view<WrongConstView>); -static_assert(!std::ranges::__simple_view<NoConstView>); -static_assert( std::ranges::__simple_view<DifferentSentinel>); -static_assert(!std::ranges::__simple_view<WrongConstSentinel>); - -// To make sure __simple_view and the test version of the concept stay in sync. -static_assert(simple_view<SimpleView>); -static_assert(!simple_view<WrongConstView>); -static_assert(!simple_view<NoConstView>); -static_assert(simple_view<DifferentSentinel>); -static_assert(!simple_view<WrongConstSentinel>); diff --git a/libcxx/test/libcxx-03/ranges/range.utility/range.utility.conv/to.internal_constraints.verify.cpp b/libcxx/test/libcxx-03/ranges/range.utility/range.utility.conv/to.internal_constraints.verify.cpp deleted file mode 100644 index 7122ae0..0000000 --- a/libcxx/test/libcxx-03/ranges/range.utility/range.utility.conv/to.internal_constraints.verify.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test that the "mandates" requirements on the given container are checked correctly using `static_assert`. - -#include <ranges> -#include <vector> - -template <bool HasDefaultCtr = true, bool HasSingleArgCtr = true, - bool HasInsert = true, bool HasInsertWithRightSignature = true, - bool HasPushBack = true, bool HasPushBackWithRightSignature = true> -struct Container { - using value_type = int; - - int* begin() const { return nullptr; } - int* end() const { return nullptr; } - - Container() - requires HasDefaultCtr = default; - - Container(int) - requires HasSingleArgCtr { - } - - int* insert(int*, int) - requires (HasInsert && HasInsertWithRightSignature) { - return nullptr; - } - - int* insert() - requires (HasInsert && !HasInsertWithRightSignature) { - return nullptr; - } - - void push_back(int) - requires (HasPushBack && HasPushBackWithRightSignature) { - } - - void push_back() - requires (HasPushBack && !HasPushBackWithRightSignature) { - } - -}; - -void test() { - using R = std::vector<int>; - R in = {1, 2, 3}; - - // Case 4 -- default-construct (or construct from the extra arguments) and insert. - { // All constraints satisfied. - using C = Container<>; - (void)std::ranges::to<C>(in); - (void)std::ranges::to<C>(in, 1); - (void)std::ranges::to<C>(in, 1.0); - } - - { // No default constructor. - using C = Container</*HasDefaultCtr=*/false>; - (void)std::ranges::to<C>(in); //expected-error-re@*:* {{static assertion failed{{.*}}ranges::to: unable to convert to the given container type}} - } - - { // No single-argument constructor. - using C = Container</*HasDefaultCtr=*/true, /*HasSingleArgCtr=*/false>; - (void)std::ranges::to<C>(in, 1); //expected-error-re@*:* {{static assertion failed{{.*}}ranges::to: unable to convert to the given container type}} - } - - { // No `insert` and no `push_back`. - using C = Container</*HasDefaultCtr=*/true, /*HasSingleArgCtr=*/true, - /*HasInsert=*/false, /*HasInsertWithRightSignature=*/false, - /*HasPushBack=*/false, /*HasPushBackWithRightSignature=*/false>; - (void)std::ranges::to<C>(in); //expected-error-re@*:* {{static assertion failed{{.*}}ranges::to: unable to convert to the given container type}} - } - - { // No `push_back`, `insert` has a wrong signature. - using C = Container</*HasDefaultCtr=*/true, /*HasSingleArgCtr=*/true, - /*HasInsert=*/true, /*HasInsertWithRightSignature=*/false, - /*HasPushBack=*/false, /*HasPushBackWithRightSignature=*/false>; - (void)std::ranges::to<C>(in); //expected-error-re@*:* {{static assertion failed{{.*}}ranges::to: unable to convert to the given container type}} - } - - { // No `insert`, `push_back` has a wrong signature. - using C = Container</*HasDefaultCtr=*/true, /*HasSingleArgCtr=*/true, - /*HasInsert=*/false, /*HasInsertWithRightSignature=*/false, - /*HasPushBack=*/true, /*HasPushBackWithRightSignature=*/false>; - (void)std::ranges::to<C>(in); //expected-error-re@*:* {{static assertion failed{{.*}}ranges::to: unable to convert to the given container type}} - } -} diff --git a/libcxx/test/libcxx-03/ranges/range.utility/range.utility.conv/to.static_assert.verify.cpp b/libcxx/test/libcxx-03/ranges/range.utility/range.utility.conv/to.static_assert.verify.cpp deleted file mode 100644 index 0800ee8..0000000 --- a/libcxx/test/libcxx-03/ranges/range.utility/range.utility.conv/to.static_assert.verify.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated-volatile - -// Test that the "mandates" requirements on the given container are checked using `static_assert`. - -#include <ranges> -#include <vector> - -void test_cv_qualifications() { - using R = std::vector<int>; - R in = {1, 2, 3}; - - //expected-error-re@*:* {{static assertion failed{{.*}}The target container cannot be const-qualified, please remove the const}} - (void)std::ranges::to<const R>(in); - //expected-error-re@*:* {{static assertion failed{{.*}}The target container cannot be const-qualified, please remove the const}} - (void)(in | std::ranges::to<const R>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target container cannot be volatile-qualified, please remove the volatile}} - (void)std::ranges::to<volatile R>(in); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target container cannot be volatile-qualified, please remove the volatile}} - (void)(in | std::ranges::to<volatile R>()); -} -//unexpected_types -void ff(); -void test_unexpected_types() { - struct C { - int member; - int f(); - }; - - enum color { red, green, blue }; - using member_func_ptr = decltype(&C::f); - using member_ptr = decltype(&C::member); - using func_ptr = decltype(&ff); - using func_t = decltype(ff); - - struct R { - int* begin() const { return nullptr; }; - int* end() const { return nullptr; }; - - operator int() const; - operator int*() const; - operator func_ptr() const; - operator member_func_ptr() const; - operator member_ptr() const; - operator color() const; - }; - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<int>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)(R{} | std::ranges::to<int>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<int*>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)(R{} | std::ranges::to<int*>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<func_ptr>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)(R{} | std::ranges::to<func_ptr>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<member_ptr>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)(R{} | std::ranges::to<member_ptr>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<func_t>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)(R{} | std::ranges::to<func_t>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<void>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - //expected-error-re@*:* {{static assertion failed{{.*}}ranges::to: unable to convert to the given container type.}} - (void)(R{} | std::ranges::to<void>()); - - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)std::ranges::to<color>(R{}); - //expected-error-re@*:* {{static assertion failed{{.*}}The target must be a class type}} - (void)(R{} | std::ranges::to<color>()); -} diff --git a/libcxx/test/libcxx-03/selftest/modules/std-and-std.compat-module.sh.cpp b/libcxx/test/libcxx-03/selftest/modules/std-and-std.compat-module.sh.cpp deleted file mode 100644 index d56ebb2..0000000 --- a/libcxx/test/libcxx-03/selftest/modules/std-and-std.compat-module.sh.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: clang-modules-build -// UNSUPPORTED: gcc - -// XFAIL: has-no-cxx-module-support - -// Make sure that the compile flags contain the expected elements. -// The tests only look for the expected components and not the exact flags. -// Otherwise changing the location of the module would break this test. - -// MODULE_DEPENDENCIES: std std.compat - -// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std=.*/std.pcm .*/std.pcm" -// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std.compat=.*/std.compat.pcm .*/std.compat.pcm" diff --git a/libcxx/test/libcxx-03/selftest/modules/std-module.sh.cpp b/libcxx/test/libcxx-03/selftest/modules/std-module.sh.cpp deleted file mode 100644 index ec43994..0000000 --- a/libcxx/test/libcxx-03/selftest/modules/std-module.sh.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: clang-modules-build -// UNSUPPORTED: gcc - -// XFAIL: has-no-cxx-module-support - -// Make sure that the compile flags contain the expected elements. -// The tests only look for the expected components and not the exact flags. -// Otherwise changing the location of the module would break this test. - -// MODULE_DEPENDENCIES: std - -// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std=.*/std.pcm .*/std.pcm" - -// The std module should not provide the std.compat module -// RUN: echo "%{compile_flags}" | grep -v "std.compat.pcm" diff --git a/libcxx/test/libcxx-03/selftest/modules/std.compat-module.sh.cpp b/libcxx/test/libcxx-03/selftest/modules/std.compat-module.sh.cpp deleted file mode 100644 index e847098..0000000 --- a/libcxx/test/libcxx-03/selftest/modules/std.compat-module.sh.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: clang-modules-build -// UNSUPPORTED: gcc - -// XFAIL: has-no-cxx-module-support - -// Make sure that the compile flags contain the expected elements. -// The tests only look for the expected components and not the exact flags. -// Otherwise changing the location of the module would break this test. - -// MODULE_DEPENDENCIES: std.compat - -// RUN: echo "%{compile_flags}" | grep -- "-fmodule-file=std.compat=.*/std.compat.pcm .*/std.compat.pcm" - -// It's unspecified whether std.compat is built on the std module. -// Therefore don't test its presence diff --git a/libcxx/test/libcxx-03/strings/basic.string/alignof.compile.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/alignof.compile.pass.cpp deleted file mode 100644 index 49cbde1..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/alignof.compile.pass.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Ensure that we never change the size or alignment of `basic_string` - -// UNSUPPORTED: c++03 - -#include <cstdint> -#include <iterator> -#include <string> - -#include "test_macros.h" -#include "min_allocator.h" -#include "test_allocator.h" - -template <class T> -class small_pointer { -public: - using value_type = T; - using difference_type = std::int16_t; - using pointer = small_pointer; - using reference = T&; - using iterator_category = std::random_access_iterator_tag; - -private: - std::uint16_t offset; -}; - -template <class T> -class small_iter_allocator { -public: - using value_type = T; - using pointer = small_pointer<T>; - using size_type = std::int16_t; - using difference_type = std::int16_t; - - small_iter_allocator() TEST_NOEXCEPT {} - - template <class U> - small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {} - - T* allocate(std::size_t n); - void deallocate(T* p, std::size_t); - - friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; } - friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; } -}; - -template <class CharT> -using min_string = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>; - -template <class CharT> -using test_string = std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>>; - -template <class CharT> -using small_string = std::basic_string<CharT, std::char_traits<CharT>, small_iter_allocator<CharT>>; - -#if __SIZE_WIDTH__ == 64 - -static_assert(alignof(std::string) == 8, ""); -static_assert(alignof(min_string<char>) == 8, ""); -static_assert(alignof(test_string<char>) == 8, ""); -static_assert(alignof(small_string<char>) == 2, ""); - -# ifndef TEST_HAS_NO_WIDE_CHARACTERS -# if __WCHAR_WIDTH__ == 32 -static_assert(alignof(std::wstring) == 8, ""); -static_assert(alignof(min_string<wchar_t>) == 8, ""); -static_assert(alignof(test_string<wchar_t>) == 8, ""); -static_assert(alignof(small_string<wchar_t>) == 4, ""); -# elif __WCHAR_WIDTH__ == 16 -static_assert(alignof(std::wstring) == 8, ""); -static_assert(alignof(min_string<wchar_t>) == 8, ""); -static_assert(alignof(test_string<wchar_t>) == 8, ""); -static_assert(alignof(small_string<wchar_t>) == 2, ""); -# else -# error "Unexpected wchar_t width" -# endif -# endif - -# ifndef TEST_HAS_NO_CHAR8_T -static_assert(alignof(std::u8string) == 8, ""); -static_assert(alignof(min_string<char8_t>) == 8, ""); -static_assert(alignof(test_string<char8_t>) == 8, ""); -static_assert(alignof(small_string<char8_t>) == 2, ""); -# endif - -# ifndef TEST_HAS_NO_UNICODE_CHARS -static_assert(alignof(std::u16string) == 8, ""); -static_assert(alignof(std::u32string) == 8, ""); -static_assert(alignof(min_string<char16_t>) == 8, ""); -static_assert(alignof(min_string<char32_t>) == 8, ""); -static_assert(alignof(test_string<char16_t>) == 8, ""); -static_assert(alignof(test_string<char32_t>) == 8, ""); -static_assert(alignof(small_string<char16_t>) == 2, ""); -static_assert(alignof(small_string<char32_t>) == 4, ""); -# endif - -#elif __SIZE_WIDTH__ == 32 - -static_assert(alignof(std::string) == 4, ""); -static_assert(alignof(min_string<char>) == 4, ""); -static_assert(alignof(test_string<char>) == 4, ""); -static_assert(alignof(small_string<char>) == 2, ""); - -# ifndef TEST_HAS_NO_WIDE_CHARACTERS -# if __WCHAR_WIDTH__ == 32 -static_assert(alignof(std::wstring) == 4, ""); -static_assert(alignof(min_string<wchar_t>) == 4, ""); -static_assert(alignof(test_string<wchar_t>) == 4, ""); -static_assert(alignof(small_string<wchar_t>) == 4, ""); -# elif __WCHAR_WIDTH__ == 16 -static_assert(alignof(std::wstring) == 4, ""); -static_assert(alignof(min_string<wchar_t>) == 4, ""); -static_assert(alignof(test_string<wchar_t>) == 4, ""); -static_assert(alignof(small_string<wchar_t>) == 2, ""); -# else -# error "Unexpected wchar_t width" -# endif -# endif - -# ifndef TEST_HAS_NO_CHAR8_T -static_assert(alignof(std::u8string) == 4, ""); -static_assert(alignof(min_string<char8_t>) == 4, ""); -static_assert(alignof(test_string<char8_t>) == 4, ""); -static_assert(alignof(small_string<char8_t>) == 2, ""); -# endif - -# ifndef TEST_HAS_NO_UNICODE_CHARS -static_assert(alignof(std::u16string) == 4, ""); -static_assert(alignof(std::u32string) == 4, ""); -static_assert(alignof(min_string<char16_t>) == 4, ""); -static_assert(alignof(min_string<char32_t>) == 4, ""); -static_assert(alignof(test_string<char16_t>) == 4, ""); -static_assert(alignof(test_string<char32_t>) == 4, ""); -static_assert(alignof(small_string<char32_t>) == 4, ""); -# endif - -#else -# error "std::size_t has an unexpected size" -#endif diff --git a/libcxx/test/libcxx-03/strings/basic.string/nonnull.verify.cpp b/libcxx/test/libcxx-03/strings/basic.string/nonnull.verify.cpp deleted file mode 100644 index d618962..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/nonnull.verify.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Ensure that APIs which take a CharT* (and no size for it) are diagnosing passing a nullptr to them - -#include <string> - -#include "test_macros.h" - -void func() { - const char* const np = nullptr; - std::string str1(np); // expected-warning {{null passed}} - std::string str2(np, std::allocator<char>{}); // expected-warning {{null passed}} - str2 = np; // expected-warning {{null passed}} - str2 += np; // expected-warning {{null passed}} - str2.append(np); // expected-warning {{null passed}} - str2.insert(0, np); // expected-warning {{null passed}} - str2.find(np); // expected-warning {{null passed}} - str2.rfind(np); // expected-warning {{null passed}} - str2.find_first_of(np); // expected-warning {{null passed}} - str2.find_last_of(np); // expected-warning {{null passed}} - str2.find_first_not_of(np); // expected-warning {{null passed}} - str2.find_last_not_of(np); // expected-warning {{null passed}} - str2.compare(np); // expected-warning {{null passed}} - str2.compare(0, 0, np); // expected-warning {{null passed}} - -#if TEST_STD_VER >= 20 - str2.starts_with(np); // expected-warning {{null passed}} - str2.ends_with(np); // expected-warning {{null passed}} -#endif -#if TEST_STD_VER >= 23 - str2.contains(np); // expected-warning {{null passed}} -#endif -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.back.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.back.pass.cpp deleted file mode 100644 index 36a485a..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.back.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call back() on empty container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S s; - TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cback.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cback.pass.cpp deleted file mode 100644 index d810acd..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cback.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call back() on empty const container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - const S s; - TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cfront.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cfront.pass.cpp deleted file mode 100644 index 12e7ef3..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cfront.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call front() on empty const container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - const S s; - TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cindex.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cindex.pass.cpp deleted file mode 100644 index 3983352..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.cindex.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Index const string out of bounds. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - const S s; - assert(s[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.front.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.front.pass.cpp deleted file mode 100644 index 24df3fc..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.front.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call front() on empty container. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S s; - TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.index.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.index.pass.cpp deleted file mode 100644 index d26997d..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.access/assert.index.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Index string out of bounds. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S s; - assert(s[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp deleted file mode 100644 index 101838e..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// <string> - -// void shrink_to_fit(); // constexpr since C++20 - -#include <cassert> -#include <string> - -#include "asan_testing.h" -#include "increasing_allocator.h" - -template <typename T> -struct oversizing_allocator { - using value_type = T; - oversizing_allocator() = default; - template <typename U> - oversizing_allocator(const oversizing_allocator<U>&) noexcept {} - std::allocation_result<T*> allocate_at_least(std::size_t n) { - ++n; - return {static_cast<T*>(::operator new(n * sizeof(T))), n}; - } - T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } - void deallocate(T* p, std::size_t) noexcept { ::operator delete(static_cast<void*>(p)); } -}; - -template <typename T, typename U> -bool operator==(oversizing_allocator<T>, oversizing_allocator<U>) { - return true; -} - -// Make sure we use an allocation returned by allocate_at_least if it is smaller than the current allocation -// even if it contains more bytes than we requested. -// Fix issue: https://github.com/llvm/llvm-project/pull/115659 -void test_oversizing_allocator() { - std::basic_string<char, std::char_traits<char>, oversizing_allocator<char>> s{ - "String does not fit in the internal buffer and is a bit longer"}; - s = "String does not fit in the internal buffer"; - std::size_t capacity = s.capacity(); - std::size_t size = s.size(); - s.shrink_to_fit(); - assert(s.capacity() < capacity); - assert(s.size() == size); -} - -// Make sure libc++ shrink_to_fit does NOT swap buffer with equal allocation sizes -void test_no_swap_with_equal_allocation_size() { - { // Test with custom allocator with a minimum allocation size - std::basic_string<char, std::char_traits<char>, min_size_allocator<128, char> > s( - "A long string exceeding SSO limit but within min alloc size"); - std::size_t capacity = s.capacity(); - std::size_t size = s.size(); - auto data = s.data(); - s.shrink_to_fit(); - assert(s.capacity() <= capacity); - assert(s.size() == size); - assert(is_string_asan_correct(s)); - assert(s.capacity() == capacity && s.data() == data); - } - { // Test with custom allocator with a minimum power of two allocation size - std::basic_string<char, std::char_traits<char>, pow2_allocator<char> > s( - "This is a long string that exceeds the SSO limit"); - std::size_t capacity = s.capacity(); - std::size_t size = s.size(); - auto data = s.data(); - s.shrink_to_fit(); - assert(s.capacity() <= capacity); - assert(s.size() == size); - assert(is_string_asan_correct(s)); - assert(s.capacity() == capacity && s.data() == data); - } -} - -int main(int, char**) { - test_oversizing_allocator(); - test_no_swap_with_equal_allocation_size(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.cons/constinit_sso_string.compile.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.cons/constinit_sso_string.compile.pass.cpp deleted file mode 100644 index 9fd82f2..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.cons/constinit_sso_string.compile.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Ensure that strings which fit within the SSO size can be constant-initialized -// as both a global and local. - -#include <string> - -#if __SIZE_WIDTH__ == 64 -# define LONGEST_STR "0123456789012345678901" -#elif __SIZE_WIDTH__ == 32 -# define LONGEST_STR "0123456789" -#else -# error "std::size_t has an unexpected size" -#endif - -constinit std::string g_str = LONGEST_STR; -void fn() { constexpr std::string l_str = LONGEST_STR; } diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.cons/debug.iterator.substr.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.cons/debug.iterator.substr.pass.cpp deleted file mode 100644 index b237a8e..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.cons/debug.iterator.substr.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Check that basic_string(basic_string&&, size_type, Allocator) and -// basic_string(basic_string&&, size_type, size_type, Allocator) inserts the container into the debug database - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <cassert> -#include <string> - -#include "check_assertion.h" - -int main(int, char**) { - using namespace std::string_literals; - - { - std::string s = {"Banane"s, 1}; - auto i = s.begin(); - assert(i[0] == 'a'); - TEST_LIBCPP_ASSERT_FAILURE(i[5], "Attempted to subscript an iterator outside its valid range"); - } - { - std::string s = {"Banane"s, 0, 5}; - auto i = s.begin(); - assert(i[0] == 'B'); - TEST_LIBCPP_ASSERT_FAILURE(i[5], "Attempted to subscript an iterator outside its valid range"); - } - { - std::string s = {"long long string so no SSO"s, 21}; - auto i = s.begin(); - assert(i[0] == 'o'); - TEST_LIBCPP_ASSERT_FAILURE(i[5], "Attempted to subscript an iterator outside its valid range"); - } - { - std::string s = {"long long string so no SSO"s, 0, 5}; - auto i = s.begin(); - assert(i[0] == 'l'); - TEST_LIBCPP_ASSERT_FAILURE(i[5], "Attempted to subscript an iterator outside its valid range"); - } -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.add.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.add.pass.cpp deleted file mode 100644 index 56c9d63..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.add.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Add to iterator out of bounds. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-string -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class C> -void test() { - C c(1, '\0'); - typename C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - TEST_LIBCPP_ASSERT_FAILURE(i += 2, "__bounded_iter::operator+=: Attempt to advance an iterator past the end"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.decrement.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.decrement.pass.cpp deleted file mode 100644 index 43a9739..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.decrement.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Decrement iterator prior to begin. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-string -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class C> -void test() { - C c(1, '\0'); - typename C::iterator i = c.end(); - --i; - assert(i == c.begin()); - TEST_LIBCPP_ASSERT_FAILURE(--i, "__bounded_iter::operator--: Attempt to rewind an iterator past the start"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.dereference.pass.cpp deleted file mode 100644 index e2326be..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.dereference.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Dereference non-dereferenceable iterator. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-string -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class C> -void test() { - C c(1, '\0'); - typename C::iterator i = c.end(); - TEST_LIBCPP_ASSERT_FAILURE(*i, "__bounded_iter::operator*: Attempt to dereference an iterator at the end"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.increment.pass.cpp deleted file mode 100644 index a7453f3..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.increment.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Increment iterator past end. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-string -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class C> -void test() { - C c(1, '\0'); - typename C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - TEST_LIBCPP_ASSERT_FAILURE(++i, "__bounded_iter::operator++: Attempt to advance an iterator past the end"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.index.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.index.pass.cpp deleted file mode 100644 index e7d3844..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/assert.iterator.index.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Index iterator out of bounds. - -// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-string -// UNSUPPORTED: libcpp-hardening-mode=none, c++03 - -#include <string> -#include <cassert> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class C> -void test() { - using T = decltype(std::uint8_t() - std::uint8_t()); - C c(1, '\0'); - typename C::iterator i = c.begin(); - assert(i[0] == 0); - TEST_LIBCPP_ASSERT_FAILURE(i[1], "__bounded_iter::operator[]: Attempt to index an iterator at or past the end"); - TEST_LIBCPP_ASSERT_FAILURE(i[-1], "__bounded_iter::operator[]: Attempt to index an iterator past the start"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp deleted file mode 100644 index c55410e..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/debug.iterator.compare.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Compare iterators from different containers with <. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S s1; - S s2; - TEST_LIBCPP_ASSERT_FAILURE(s1.begin() < s2.begin(), "Attempted to compare incomparable iterators"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp deleted file mode 100644 index d3274cb..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.iterators/debug.iterator.subtract.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Subtract iterators from different containers. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S s1; - S s2; - TEST_LIBCPP_ASSERT_FAILURE(s1.begin() - s2.begin(), "Attempted to subtract incompatible iterators"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp deleted file mode 100644 index 036e759..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/assert.erase_iter.null.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator position) with end() - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S l1("123"); - typename S::const_iterator i = l1.end(); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "string::erase(iterator) called with a non-dereferenceable iterator"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp deleted file mode 100644 index 54c011c..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/assert.pop_back.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// void pop_back(); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <string> - -#include "check_assertion.h" - -template <class S> -void test() { - S s; - TEST_LIBCPP_ASSERT_FAILURE(s.pop_back(), "string::pop_back(): string is already empty"); -} - -int main(int, char**) { - test<std::string>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp deleted file mode 100644 index 93fd6ca..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.erase.iter.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator position) with an iterator from another container - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - S l1("123"); - S l2("123"); - typename S::const_iterator i = l2.begin(); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(i), "string::erase(iterator) called with an iterator not referring to this string"); -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp deleted file mode 100644 index ed97e21..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.erase.iter_iter.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// Call erase(const_iterator first, const_iterator last); with invalid iterators - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <string> - -#include "check_assertion.h" -#include "min_allocator.h" - -template <class S> -void test() { - // With first iterator from another container - { - S l1("123"); - S l2("123"); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), l1.cbegin() + 1), - "string::erase(iterator, iterator) called with an iterator not referring to this string"); - } - - // With second iterator from another container - { - S l1("123"); - S l2("123"); - TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), l2.cbegin() + 1), "Attempted to compare incomparable iterators"); - } - - // With both iterators from another container - { - S l1("123"); - S l2("123"); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l2.cbegin(), l2.cbegin() + 1), - "string::erase(iterator, iterator) called with an iterator not referring to this string"); - } - - // With an invalid range - { - S l1("123"); - TEST_LIBCPP_ASSERT_FAILURE( - l1.erase(l1.cbegin() + 1, l1.cbegin()), "string::erase(first, last) called with invalid range"); - } -} - -int main(int, char**) { - test<std::string>(); - test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp deleted file mode 100644 index 561f79e..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_char.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// iterator insert(const_iterator p, charT c); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -// TODO: Since string::insert(iter, char) is intantiated in the dylib, this test doesn't -// actually work if the dylib hasn't been built with debug assertions enabled. -// Until we overhaul the debug mode, mark this test as unsupported to avoid -// spurious CI failures. -// REQUIRES: never-run - -#include <string> - -#include "check_assertion.h" - -template <class S> -void test() { - S s; - S s2; - TEST_LIBCPP_ASSERT_FAILURE( - s.insert(s2.begin(), '1'), - "string::insert(iterator, character) called with an iterator not referring to this string"); -} - -int main(int, char**) { - test<std::string>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp deleted file mode 100644 index eef5253..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_iter_iter.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// template<class InputIterator> -// iterator insert(const_iterator p, InputIterator first, InputIterator last); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <string> - -#include "check_assertion.h" - -template <class S> -void test() { - S v; - S v2; - char a[] = "123"; - const int N = sizeof(a) / sizeof(a[0]); - TEST_LIBCPP_ASSERT_FAILURE( - v.insert(v2.cbegin() + 10, a, a + N), "Attempted to add/subtract an iterator outside its valid range"); -} - -int main(int, char**) { - test<std::string>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp deleted file mode 100644 index 4b75326..0000000 --- a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/debug.insert.iter_size_char.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <string> - -// iterator insert(const_iterator p, size_type n, charT c); - -// REQUIRES: has-unix-headers -// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 - -#include <string> - -#include "check_assertion.h" - -template <class S> -void test() { - S s; - S s2; - TEST_LIBCPP_ASSERT_FAILURE(s.insert(s2.begin(), 1, 'a'), - "string::insert(iterator, n, value) called with an iterator not referring to this string"); -} - -int main(int, char**) { - test<std::string>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/c.strings/constexpr.cstring.compile.pass.cpp b/libcxx/test/libcxx-03/strings/c.strings/constexpr.cstring.compile.pass.cpp deleted file mode 100644 index cd993d8..0000000 --- a/libcxx/test/libcxx-03/strings/c.strings/constexpr.cstring.compile.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -// Check that __constexpr_* cstring functions are actually constexpr - -#include <__string/constexpr_c_functions.h> - -constexpr unsigned char Banand[] = "Banand"; -constexpr unsigned char Banane[] = "Banane"; -constexpr unsigned char Bananf[] = "Bananf"; - -static_assert(std::__constexpr_strlen("Banane") == 6, ""); -static_assert(std::__constexpr_memcmp(Banane, Banand, std::__element_count(6)) == 1, ""); -static_assert(std::__constexpr_memcmp(Banane, Banane, std::__element_count(6)) == 0, ""); -static_assert(std::__constexpr_memcmp(Banane, Bananf, std::__element_count(6)) == -1, ""); - -static_assert(!std::__constexpr_memcmp_equal(Banane, Banand, std::__element_count(6)), ""); -static_assert(std::__constexpr_memcmp_equal(Banane, Banane, std::__element_count(6)), ""); - -constexpr bool test_constexpr_wmemchr() { - const char str[] = "Banane"; - return std::__constexpr_memchr(str, 'n', 6) == str + 2; -} -static_assert(test_constexpr_wmemchr(), ""); diff --git a/libcxx/test/libcxx-03/strings/c.strings/constexpr.cwchar.compile.pass.cpp b/libcxx/test/libcxx-03/strings/c.strings/constexpr.cwchar.compile.pass.cpp deleted file mode 100644 index 02feed0..0000000 --- a/libcxx/test/libcxx-03/strings/c.strings/constexpr.cwchar.compile.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -// UNSUPPORTED: no-wide-characters - -// Check that __constexpr_* cwchar functions are actually constexpr - -#include <cwchar> - -static_assert(std::__constexpr_wcslen(L"Banane") == 6, ""); -static_assert(std::__constexpr_wmemcmp(L"Banane", L"Banand", 6) == 1, ""); -static_assert(std::__constexpr_wmemcmp(L"Banane", L"Banane", 6) == 0, ""); -static_assert(std::__constexpr_wmemcmp(L"Banane", L"Bananf", 6) == -1, ""); - -constexpr bool test_constexpr_wmemchr() { - const wchar_t str[] = L"Banane"; - return std::__constexpr_wmemchr(str, 'n', 6) == str + 2; -} -static_assert(test_constexpr_wmemchr(), ""); diff --git a/libcxx/test/libcxx-03/strings/string.view/assert.ctor.length.pass.cpp b/libcxx/test/libcxx-03/strings/string.view/assert.ctor.length.pass.cpp deleted file mode 100644 index af8b393..0000000 --- a/libcxx/test/libcxx-03/strings/string.view/assert.ctor.length.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// Construct a string_view from an invalid length -// constexpr basic_string_view( const _CharT* s, size_type len ) - -#include <string_view> - -#include "check_assertion.h" - -int main(int, char**) { - char c = 0; - TEST_LIBCPP_ASSERT_FAILURE( - std::string_view(&c, -1), "string_view::string_view(_CharT *, size_t): length does not fit in difference_type"); - return 0; -} diff --git a/libcxx/test/libcxx-03/strings/string.view/assert.ctor.pointer.pass.cpp b/libcxx/test/libcxx-03/strings/string.view/assert.ctor.pointer.pass.cpp deleted file mode 100644 index 1810ec1..0000000 --- a/libcxx/test/libcxx-03/strings/string.view/assert.ctor.pointer.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// Construct a string_view from a null pointer -// constexpr basic_string_view( const CharT* s ); - -#include <string_view> - -#include "check_assertion.h" - -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE( - std::string_view((char const*)NULL), "null pointer passed to non-null argument of char_traits<...>::length"); - TEST_LIBCPP_ASSERT_FAILURE( - std::string_view((char const*)nullptr), "null pointer passed to non-null argument of char_traits<...>::length"); - TEST_LIBCPP_ASSERT_FAILURE( - std::string_view((char const*)0), "null pointer passed to non-null argument of char_traits<...>::length"); - { - std::string_view v; - TEST_LIBCPP_ASSERT_FAILURE( - v == (char const*)nullptr, "null pointer passed to non-null argument of char_traits<...>::length"); - TEST_LIBCPP_ASSERT_FAILURE( - v == (char const*)NULL, "null pointer passed to non-null argument of char_traits<...>::length"); - TEST_LIBCPP_ASSERT_FAILURE( - (char const*)nullptr == v, "null pointer passed to non-null argument of char_traits<...>::length"); - TEST_LIBCPP_ASSERT_FAILURE( - (char const*)NULL == v, "null pointer passed to non-null argument of char_traits<...>::length"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/atomic.availability.verify.cpp b/libcxx/test/libcxx-03/thread/atomic.availability.verify.cpp deleted file mode 100644 index 419be93..0000000 --- a/libcxx/test/libcxx-03/thread/atomic.availability.verify.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// REQUIRES: availability-synchronization_library-missing - -// Test the availability markup on the C++20 Synchronization Library -// additions to <atomic>. - -#include <atomic> - -void f() { - { - std::atomic<int> i(3); - std::memory_order m = std::memory_order_relaxed; - - i.wait(4); // expected-error {{is unavailable}} - i.wait(4, m); // expected-error {{is unavailable}} - i.notify_one(); // expected-error {{is unavailable}} - i.notify_all(); // expected-error {{is unavailable}} - - std::atomic_wait(&i, 4); // expected-error {{is unavailable}} - std::atomic_wait_explicit(&i, 4, m); // expected-error {{is unavailable}} - std::atomic_notify_one(&i); // expected-error {{is unavailable}} - std::atomic_notify_all(&i); // expected-error {{is unavailable}} - } - - { - std::atomic<int> volatile i(3); - std::memory_order m = std::memory_order_relaxed; - - i.wait(4); // expected-error {{is unavailable}} - i.wait(4, m); // expected-error {{is unavailable}} - i.notify_one(); // expected-error {{is unavailable}} - i.notify_all(); // expected-error {{is unavailable}} - - std::atomic_wait(&i, 4); // expected-error {{is unavailable}} - std::atomic_wait_explicit(&i, 4, m); // expected-error {{is unavailable}} - std::atomic_notify_one(&i); // expected-error {{is unavailable}} - std::atomic_notify_all(&i); // expected-error {{is unavailable}} - } - - { - std::atomic_flag flag; - bool b = false; - std::memory_order m = std::memory_order_relaxed; - flag.wait(b); // expected-error {{is unavailable}} - flag.wait(b, m); // expected-error {{is unavailable}} - flag.notify_one(); // expected-error {{is unavailable}} - flag.notify_all(); // expected-error {{is unavailable}} - - std::atomic_flag_wait(&flag, b); // expected-error {{is unavailable}} - std::atomic_flag_wait_explicit(&flag, b, m); // expected-error {{is unavailable}} - std::atomic_flag_notify_one(&flag); // expected-error {{is unavailable}} - std::atomic_flag_notify_all(&flag); // expected-error {{is unavailable}} - } - - { - std::atomic_flag volatile flag; - bool b = false; - std::memory_order m = std::memory_order_relaxed; - flag.wait(b); // expected-error {{is unavailable}} - flag.wait(b, m); // expected-error {{is unavailable}} - flag.notify_one(); // expected-error {{is unavailable}} - flag.notify_all(); // expected-error {{is unavailable}} - - std::atomic_flag_wait(&flag, b); // expected-error {{is unavailable}} - std::atomic_flag_wait_explicit(&flag, b, m); // expected-error {{is unavailable}} - std::atomic_flag_notify_one(&flag); // expected-error {{is unavailable}} - std::atomic_flag_notify_all(&flag); // expected-error {{is unavailable}} - } -} diff --git a/libcxx/test/libcxx-03/thread/barrier.availability.verify.cpp b/libcxx/test/libcxx-03/thread/barrier.availability.verify.cpp deleted file mode 100644 index c9baa8b2..0000000 --- a/libcxx/test/libcxx-03/thread/barrier.availability.verify.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// REQUIRES: availability-synchronization_library-missing - -// Test the availability markup on std::barrier. - -#include <barrier> -#include <utility> - -struct CompletionF { - void operator()() { } -}; - -void f() { - // Availability markup on std::barrier<> - { - std::barrier<> b(10); // expected-error {{is unavailable}} - auto token = b.arrive(); // expected-error {{is unavailable}} - (void)b.arrive(10); // expected-error {{is unavailable}} - b.wait(std::move(token)); // expected-error {{is unavailable}} - b.arrive_and_wait(); // expected-error {{is unavailable}} - b.arrive_and_drop(); // expected-error {{is unavailable}} - } - - // Availability markup on std::barrier<CompletionF> with non-default CompletionF - { - std::barrier<CompletionF> b(10); // expected-error {{is unavailable}} - auto token = b.arrive(); // expected-error {{is unavailable}} - (void)b.arrive(10); // expected-error {{is unavailable}} - b.wait(std::move(token)); // expected-error {{is unavailable}} - b.arrive_and_wait(); // expected-error {{is unavailable}} - b.arrive_and_drop(); // expected-error {{is unavailable}} - } -} diff --git a/libcxx/test/libcxx-03/thread/futures/futures.promise/assert.set_exception.pass.cpp b/libcxx/test/libcxx-03/thread/futures/futures.promise/assert.set_exception.pass.cpp deleted file mode 100644 index 6d5eb5e..0000000 --- a/libcxx/test/libcxx-03/thread/futures/futures.promise/assert.set_exception.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-threads -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <future> - -// class promise<R> - -// void set_exception(exception_ptr p); -// Test that a null exception_ptr is diagnosed. - -#include <future> -#include <exception> - -#include "check_assertion.h" - -int main(int, char**) { - { - typedef int T; - std::promise<T> p; - TEST_LIBCPP_ASSERT_FAILURE(p.set_exception(std::exception_ptr()), "promise::set_exception: received nullptr"); - } - - { - typedef int& T; - std::promise<T> p; - TEST_LIBCPP_ASSERT_FAILURE(p.set_exception(std::exception_ptr()), "promise::set_exception: received nullptr"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp b/libcxx/test/libcxx-03/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp deleted file mode 100644 index 1bffde5..0000000 --- a/libcxx/test/libcxx-03/thread/futures/futures.promise/assert.set_exception_at_thread_exit.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, no-threads -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <future> - -// class promise<R> - -// void set_exception_on_thread_exit(exception_ptr p); -// Test that a null exception_ptr is diagnosed. - -#include <future> -#include <exception> - -#include "check_assertion.h" - -int main(int, char**) { - { - typedef int T; - std::promise<T> p; - TEST_LIBCPP_ASSERT_FAILURE(p.set_exception_at_thread_exit(std::exception_ptr()), "promise::set_exception_at_thread_exit: received nullptr"); - } - - { - typedef int& T; - std::promise<T> p; - TEST_LIBCPP_ASSERT_FAILURE(p.set_exception_at_thread_exit(std::exception_ptr()), "promise::set_exception_at_thread_exit: received nullptr"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/futures/futures.task/type.depr.verify.cpp b/libcxx/test/libcxx-03/thread/futures/futures.task/type.depr.verify.cpp deleted file mode 100644 index 4065637..0000000 --- a/libcxx/test/libcxx-03/thread/futures/futures.task/type.depr.verify.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 - -// <future> - -// template<class R, class... ArgTypes> -// class packaged_task<R(ArgTypes...)> -// { -// public: -// typedef R result_type; // extension - -// This libc++ extension is deprecated. See https://github.com/llvm/llvm-project/issues/112856. - -#include <future> -#include <type_traits> - -struct A {}; - -using RA = std::packaged_task<A(int, char)>::result_type; // expected-warning {{'result_type' is deprecated}} -using RV = std::packaged_task<void(int, char)>::result_type; // expected-warning {{'result_type' is deprecated}} diff --git a/libcxx/test/libcxx-03/thread/futures/futures.task/types.pass.cpp b/libcxx/test/libcxx-03/thread/futures/futures.task/types.pass.cpp deleted file mode 100644 index 659232c..0000000 --- a/libcxx/test/libcxx-03/thread/futures/futures.task/types.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 - -// <future> - -// template<class R, class... ArgTypes> -// class packaged_task<R(ArgTypes...)> -// { -// public: -// typedef R result_type; // extension - -// This is a libc++ extension. - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - -#include <future> -#include <type_traits> - -struct A {}; - -int main(int, char**) { - static_assert((std::is_same<std::packaged_task<A(int, char)>::result_type, A>::value), ""); - static_assert((std::is_same<std::packaged_task<void(int, char)>::result_type, void>::value), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/latch.availability.verify.cpp b/libcxx/test/libcxx-03/thread/latch.availability.verify.cpp deleted file mode 100644 index 3aa50ea..0000000 --- a/libcxx/test/libcxx-03/thread/latch.availability.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// REQUIRES: availability-synchronization_library-missing - -// Test the availability markup on std::latch. - -#include <latch> - -void f() { - std::latch latch(10); - latch.count_down(); // expected-error {{is unavailable}} - latch.count_down(3); // expected-error {{is unavailable}} - latch.wait(); // expected-error {{is unavailable}} - latch.arrive_and_wait(); // expected-error {{is unavailable}} - latch.arrive_and_wait(3); // expected-error {{is unavailable}} -} diff --git a/libcxx/test/libcxx-03/thread/semaphore.availability.verify.cpp b/libcxx/test/libcxx-03/thread/semaphore.availability.verify.cpp deleted file mode 100644 index 29a6a60..0000000 --- a/libcxx/test/libcxx-03/thread/semaphore.availability.verify.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// REQUIRES: availability-synchronization_library-missing - -// Test the availability markup on std::counting_semaphore and std::binary_semaphore. - -#include <chrono> -#include <semaphore> - -void f() { - { - // Tests for std::counting_semaphore with non-default template argument - std::counting_semaphore<20> sem(10); - sem.release(); // expected-error {{is unavailable}} - sem.release(5); // expected-error {{is unavailable}} - sem.acquire(); // expected-error {{is unavailable}} - sem.try_acquire_for(std::chrono::milliseconds{3}); // expected-error 1-2 {{is unavailable}} - sem.try_acquire(); // expected-error {{is unavailable}} - sem.try_acquire_until(std::chrono::steady_clock::now()); // expected-error 1-2 {{is unavailable}} - } - { - // Tests for std::counting_semaphore with default template argument - std::counting_semaphore<> sem(10); - sem.release(); // expected-error {{is unavailable}} - sem.release(5); // expected-error {{is unavailable}} - sem.acquire(); // expected-error {{is unavailable}} - sem.try_acquire_for(std::chrono::milliseconds{3}); // expected-error 1-2 {{is unavailable}} - sem.try_acquire(); // expected-error {{is unavailable}} - sem.try_acquire_until(std::chrono::steady_clock::now()); // expected-error 1-2 {{is unavailable}} - } - { - // Tests for std::binary_semaphore - std::binary_semaphore sem(10); - sem.release(); // expected-error {{is unavailable}} - sem.release(5); // expected-error {{is unavailable}} - sem.acquire(); // expected-error {{is unavailable}} - sem.try_acquire_for(std::chrono::milliseconds{3}); // expected-error 1-2 {{is unavailable}} - sem.try_acquire(); // expected-error {{is unavailable}} - sem.try_acquire_until(std::chrono::steady_clock::now()); // expected-error 1-2 {{is unavailable}} - } -} diff --git a/libcxx/test/libcxx-03/thread/thread.barrier/assert.arrive.pass.cpp b/libcxx/test/libcxx-03/thread/thread.barrier/assert.arrive.pass.cpp deleted file mode 100644 index 419a603..0000000 --- a/libcxx/test/libcxx-03/thread/thread.barrier/assert.arrive.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} - -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// REQUIRES: has-unix-headers - -// <barrier> - -// class barrier; - -// void arrive(ptrdiff_t __update = 1); - -// Make sure that calling arrive with a negative value or with a value greater than 'expected' triggers an assertion - -#include <barrier> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::barrier<> b(5); - TEST_LIBCPP_ASSERT_FAILURE(b.arrive(0), "barrier:arrive must be called with a value greater than 0"); - } - - { - std::barrier<> b(5); - TEST_LIBCPP_ASSERT_FAILURE(b.arrive(10), "update is greater than the expected count for the current barrier phase"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.barrier/assert.ctor.pass.cpp b/libcxx/test/libcxx-03/thread/thread.barrier/assert.ctor.pass.cpp deleted file mode 100644 index 0b4fb1d..0000000 --- a/libcxx/test/libcxx-03/thread/thread.barrier/assert.ctor.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} - -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// REQUIRES: has-unix-headers - -// <barrier> - -// class barrier; - -// barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF()); - -// Make sure that constructing barrier with a negative value triggers an assertion - -#include <barrier> - -#include "check_assertion.h" - -int main(int, char**) { - { - TEST_LIBCPP_ASSERT_FAILURE( - [] { std::barrier<> b(-1); }(), - "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value"); - } - - { - TEST_LIBCPP_ASSERT_FAILURE( - [] { - auto completion = []() {}; - std::barrier<decltype(completion)> b(-1, completion); - }(), - "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value"); - } - - // We can't check the precondition for max() because there's no value - // that would violate the precondition (in our implementation) - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp b/libcxx/test/libcxx-03/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp deleted file mode 100644 index 6625164..0000000 --- a/libcxx/test/libcxx-03/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: no-threads -// REQUIRES: libcpp-has-thread-api-pthread - -// notify_all_at_thread_exit(...) requires move semantics to transfer the -// unique_lock. -// UNSUPPORTED: c++03 - -// <condition_variable> - -// void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk); - -// Test that this function works with threads that were not created by -// std::thread. See https://llvm.org/PR30202 - - -#include <condition_variable> -#include <mutex> -#include <thread> -#include <chrono> -#include <cassert> -#include <pthread.h> - -#include "test_macros.h" - -std::condition_variable cv; -std::mutex mut; -bool exited = false; - -typedef std::chrono::milliseconds ms; -typedef std::chrono::high_resolution_clock Clock; - -void* func(void*) -{ - std::unique_lock<std::mutex> lk(mut); - std::notify_all_at_thread_exit(cv, std::move(lk)); - std::this_thread::sleep_for(ms(300)); - exited = true; - return nullptr; -} - -int main(int, char**) -{ - { - std::unique_lock<std::mutex> lk(mut); - pthread_t id; - int res = pthread_create(&id, 0, &func, nullptr); - assert(res == 0); - Clock::time_point t0 = Clock::now(); - assert(exited == false); - cv.wait(lk); - Clock::time_point t1 = Clock::now(); - assert(exited); - assert(t1-t0 > ms(250)); - pthread_join(id, 0); - } - exited = false; - { - std::unique_lock<std::mutex> lk(mut); - std::thread t(&func, nullptr); - Clock::time_point t0 = Clock::now(); - assert(exited == false); - cv.wait(lk); - Clock::time_point t1 = Clock::now(); - assert(exited); - assert(t1-t0 > ms(250)); - t.join(); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.latch/assert.arrive_and_wait.pass.cpp b/libcxx/test/libcxx-03/thread/thread.latch/assert.arrive_and_wait.pass.cpp deleted file mode 100644 index e6167955..0000000 --- a/libcxx/test/libcxx-03/thread/thread.latch/assert.arrive_and_wait.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <latch> - -// class latch; - -// void arrive_and_wait(ptrdiff_t __update = 1); - -// Make sure that calling arrive_and_wait with a negative value triggers an assertion. - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <latch> - -#include "check_assertion.h" - -int main(int, char **) { - { - std::latch l(5); - - TEST_LIBCPP_ASSERT_FAILURE( - l.arrive_and_wait(-10), - "latch::arrive_and_wait called with a negative value"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.latch/assert.count_down.pass.cpp b/libcxx/test/libcxx-03/thread/thread.latch/assert.count_down.pass.cpp deleted file mode 100644 index 6220cba..0000000 --- a/libcxx/test/libcxx-03/thread/thread.latch/assert.count_down.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <latch> - -// class latch; - -// void count_down(ptrdiff_t __update = 1); - -// Make sure that calling count_down with a negative value or a value -// higher than the internal counter triggers an assertion. - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <latch> - -#include "check_assertion.h" - -int main(int, char **) { - { - std::latch l(5); - - TEST_LIBCPP_ASSERT_FAILURE( - l.count_down(-10), "latch::count_down called with a negative value"); - } - - { - std::latch l(5); - - TEST_LIBCPP_ASSERT_FAILURE(l.count_down(10), - "latch::count_down called with a value greater " - "than the internal counter"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.latch/assert.ctor.pass.cpp b/libcxx/test/libcxx-03/thread/thread.latch/assert.ctor.pass.cpp deleted file mode 100644 index 5f1ea19..0000000 --- a/libcxx/test/libcxx-03/thread/thread.latch/assert.ctor.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <latch> - -// class latch; - -// constexpr explicit latch(ptrdiff_t __expected); - -// Make sure that calling latch with a negative value triggers an assertion - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <latch> - -#include "check_assertion.h" - -int main(int, char **) { - { - TEST_LIBCPP_ASSERT_FAILURE([]{ std::latch l(-1); }(), - "latch::latch(ptrdiff_t): latch cannot be " - "initialized with a negative value"); - } - - // We can't check the precondition for max() because there's no value - // that would violate the precondition (in our implementation) - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp deleted file mode 100644 index 5d40fa7..0000000 --- a/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 - -// <mutex> - -// This test does not define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS so it -// should compile without any warnings or errors even though this pattern is not -// understood by the thread safety annotations. - -#include <mutex> - -#include "test_macros.h" - -int main(int, char**) { - std::mutex m; - m.lock(); - { - std::unique_lock<std::mutex> g(m, std::adopt_lock); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.semaphore/assert.ctor.pass.cpp b/libcxx/test/libcxx-03/thread/thread.semaphore/assert.ctor.pass.cpp deleted file mode 100644 index 1e33add..0000000 --- a/libcxx/test/libcxx-03/thread/thread.semaphore/assert.ctor.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} - -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// REQUIRES: has-unix-headers - -// <semaphore> - -// constexpr explicit counting_semaphore(ptrdiff_t __count); - -// Make sure that constructing counting_semaphore with a negative value triggers an assertion - -#include <semaphore> - -#include "check_assertion.h" - -int main(int, char**) { - { - TEST_LIBCPP_ASSERT_FAILURE( - [] { std::counting_semaphore<> s(-1); }(), - "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be " - "initialized with a negative value"); - } - // We can't check the precondition for max() because there's no value - // that would violate the precondition (in our implementation) - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.semaphore/assert.release.pass.cpp b/libcxx/test/libcxx-03/thread/thread.semaphore/assert.release.pass.cpp deleted file mode 100644 index a5a01a3..0000000 --- a/libcxx/test/libcxx-03/thread/thread.semaphore/assert.release.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} - -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// REQUIRES: has-unix-headers - -// <semaphore> - -// void release(ptrdiff_t __update = 1); - -// Make sure that calling release with a negative value triggers or with a value -// greater than expected triggers an assertion - -#include <semaphore> - -#include "check_assertion.h" - -int main(int, char**) { - { - std::counting_semaphore<> s(2); - TEST_LIBCPP_ASSERT_FAILURE(s.release(-1), "counting_semaphore:release called with a negative value"); - } - - { - // Call release with an arbitrary larger than expected value - std::counting_semaphore<> s(2); - TEST_LIBCPP_ASSERT_FAILURE( - s.release(std::counting_semaphore<>::max()), "update is greater than the expected value"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.shared_mutex/thread_safety.verify.cpp b/libcxx/test/libcxx-03/thread/thread.shared_mutex/thread_safety.verify.cpp deleted file mode 100644 index fee940f..0000000 --- a/libcxx/test/libcxx-03/thread/thread.shared_mutex/thread_safety.verify.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-threads -// REQUIRES: thread-safety -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS - -// On Windows Clang bugs out when both __declspec and __attribute__ are present, -// the processing goes awry preventing the definition of the types. -// XFAIL: msvc - -// <shared_mutex> -// -// class shared_mutex; -// -// void lock(); -// bool try_lock(); -// void unlock(); -// -// void lock_shared(); -// bool try_lock_shared(); -// void unlock_shared(); - -#include <shared_mutex> - -std::shared_mutex m; -int data __attribute__((guarded_by(m))) = 0; -void read(int); - -void f() { - // Exclusive locking - { - m.lock(); - ++data; // ok - m.unlock(); - } - { - if (m.try_lock()) { - ++data; // ok - m.unlock(); - } - } - - // Shared locking - { - m.lock_shared(); - read(data); // ok - ++data; // expected-error {{writing variable 'data' requires holding shared_mutex 'm' exclusively}} - m.unlock_shared(); - } - { - if (m.try_lock_shared()) { - read(data); // ok - ++data; // expected-error {{writing variable 'data' requires holding shared_mutex 'm' exclusively}} - m.unlock_shared(); - } - } -} diff --git a/libcxx/test/libcxx-03/thread/thread.shared_timed_mutex/thread_safety.verify.cpp b/libcxx/test/libcxx-03/thread/thread.shared_timed_mutex/thread_safety.verify.cpp deleted file mode 100644 index baa8bc6..0000000 --- a/libcxx/test/libcxx-03/thread/thread.shared_timed_mutex/thread_safety.verify.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// UNSUPPORTED: no-threads -// REQUIRES: thread-safety -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS - -// On Windows Clang bugs out when both __declspec and __attribute__ are present, -// the processing goes awry preventing the definition of the types. -// XFAIL: msvc - -// <shared_mutex> -// -// class shared_timed_mutex; -// -// void lock(); -// bool try_lock(); -// bool try_lock_for(const std::chrono::duration<Rep, Period>&); -// bool try_lock_until(const std::chrono::time_point<Clock, Duration>&); -// void unlock(); -// -// void lock_shared(); -// bool try_lock_shared(); -// bool try_lock_shared_for(const std::chrono::duration<Rep, Period>&); -// bool try_lock_shared_until(const std::chrono::time_point<Clock, Duration>&); -// void unlock_shared(); - -#include <chrono> -#include <shared_mutex> - -std::shared_timed_mutex m; -int data __attribute__((guarded_by(m))) = 0; -void read(int); - -void f(std::chrono::time_point<std::chrono::steady_clock> tp, std::chrono::milliseconds d) { - // Exclusive locking - { - m.lock(); - ++data; // ok - m.unlock(); - } - { - if (m.try_lock()) { - ++data; // ok - m.unlock(); - } - } - { - if (m.try_lock_for(d)) { - ++data; // ok - m.unlock(); - } - } - { - if (m.try_lock_until(tp)) { - ++data; // ok - m.unlock(); - } - } - - // Shared locking - { - m.lock_shared(); - read(data); // ok - ++data; // expected-error {{writing variable 'data' requires holding shared_timed_mutex 'm' exclusively}} - m.unlock_shared(); - } - { - if (m.try_lock_shared()) { - read(data); // ok - ++data; // expected-error {{writing variable 'data' requires holding shared_timed_mutex 'm' exclusively}} - m.unlock_shared(); - } - } - { - if (m.try_lock_shared_for(d)) { - read(data); // ok - ++data; // expected-error {{writing variable 'data' requires holding shared_timed_mutex 'm' exclusively}} - m.unlock_shared(); - } - } - { - if (m.try_lock_shared_until(tp)) { - read(data); // ok - ++data; // expected-error {{writing variable 'data' requires holding shared_timed_mutex 'm' exclusively}} - m.unlock_shared(); - } - } -} diff --git a/libcxx/test/libcxx-03/thread/thread.stoptoken/atomic_unique_lock.pass.cpp b/libcxx/test/libcxx-03/thread/thread.stoptoken/atomic_unique_lock.pass.cpp deleted file mode 100644 index a8093ae..0000000 --- a/libcxx/test/libcxx-03/thread/thread.stoptoken/atomic_unique_lock.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: availability-synchronization_library-missing -// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header - -#include <__stop_token/atomic_unique_lock.h> -#include <atomic> -#include <cassert> -#include <chrono> -#include <cstdint> -#include <thread> - -#include "make_test_thread.h" -#include "test_macros.h" - -template <uint8_t LockBit> -void test() { - using Lock = std::__atomic_unique_lock<uint8_t, LockBit>; - - // lock on constructor - { - std::atomic<uint8_t> state{0}; - Lock l(state); - assert(l.__owns_lock()); - } - - // always give up locking - { - std::atomic<uint8_t> state{0}; - Lock l(state, [](auto const&) { return true; }); - assert(!l.__owns_lock()); - } - - // test overload that has custom state after lock - { - std::atomic<uint8_t> state{0}; - auto neverGiveUpLocking = [](auto const&) { return false; }; - auto stateAfter = [](auto) { return uint8_t{255}; }; - Lock l(state, neverGiveUpLocking, stateAfter, std::memory_order_acq_rel); - assert(l.__owns_lock()); - assert(state.load() == 255); - } - - // lock and unlock - { - std::atomic<uint8_t> state{0}; - Lock l(state); - assert(l.__owns_lock()); - - l.__unlock(); - assert(!l.__owns_lock()); - - l.__lock(); - assert(l.__owns_lock()); - } - - // lock blocking - { - std::atomic<uint8_t> state{0}; - int i = 0; - Lock l1(state); - - auto thread1 = support::make_test_thread([&] { - std::this_thread::sleep_for(std::chrono::milliseconds{10}); - i = 5; - l1.__unlock(); - }); - - Lock l2(state); - // l2's lock has to wait for l1's unlocking - assert(i == 5); - - thread1.join(); - } -} - -int main(int, char**) { - test<1 << 0>(); - test<1 << 1>(); - test<1 << 2>(); - test<1 << 3>(); - test<1 << 4>(); - test<1 << 5>(); - test<1 << 6>(); - test<1 << 7>(); - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.stoptoken/intrusive_list_view.pass.cpp b/libcxx/test/libcxx-03/thread/thread.stoptoken/intrusive_list_view.pass.cpp deleted file mode 100644 index d8cd2fb..0000000 --- a/libcxx/test/libcxx-03/thread/thread.stoptoken/intrusive_list_view.pass.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header - -#include <__stop_token/intrusive_list_view.h> -#include <cassert> - -#include "test_macros.h" - -struct Node : std::__intrusive_node_base<Node> { - int i; - - Node(int ii) : i(ii) {} -}; - -using ListView = std::__intrusive_list_view<Node>; - -int main(int, char**) { - // empty - { - ListView list; - assert(list.__empty()); - } - - // push_front - { - ListView list; - Node n1(5); - list.__push_front(&n1); - assert(!list.__empty()); - } - - // pop_front - { - ListView list; - Node n1(5); - Node n2(6); - list.__push_front(&n1); - list.__push_front(&n2); - - auto f1 = list.__pop_front(); - assert(f1->i == 6); - - auto f2 = list.__pop_front(); - assert(f2->i == 5); - - assert(list.__empty()); - } - - // remove head - { - ListView list; - Node n1(5); - Node n2(6); - list.__push_front(&n1); - list.__push_front(&n2); - - list.__remove(&n2); - - auto f = list.__pop_front(); - assert(f->i == 5); - - assert(list.__empty()); - } - - // remove non-head - { - ListView list; - Node n1(5); - Node n2(6); - Node n3(7); - list.__push_front(&n1); - list.__push_front(&n2); - list.__push_front(&n3); - - list.__remove(&n2); - - auto f1 = list.__pop_front(); - assert(f1->i == 7); - - auto f2 = list.__pop_front(); - assert(f2->i == 5); - - assert(list.__empty()); - } - - // is_head - { - ListView list; - Node n1(5); - Node n2(6); - list.__push_front(&n1); - list.__push_front(&n2); - - assert(!list.__is_head(&n1)); - assert(list.__is_head(&n2)); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp b/libcxx/test/libcxx-03/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp deleted file mode 100644 index 99d4226..0000000 --- a/libcxx/test/libcxx-03/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header - -#include <__stop_token/intrusive_shared_ptr.h> -#include <atomic> -#include <cassert> -#include <utility> - -#include "test_macros.h" - -struct Object { - std::atomic<int> counter = 0; -}; - -template <> -struct std::__intrusive_shared_ptr_traits<Object> { - static std::atomic<int>& __get_atomic_ref_count(Object& obj) { return obj.counter; } -}; - -using Ptr = std::__intrusive_shared_ptr<Object>; - -int main(int, char**) { - // default - { - Ptr ptr; - assert(!ptr); - } - - // raw ptr - { - auto object = new Object; - Ptr ptr(object); - assert(ptr->counter == 1); - } - - // copy - { - auto object = new Object; - Ptr ptr(object); - auto ptr2 = ptr; - assert(ptr->counter == 2); - assert(ptr2->counter == 2); - } - - // move - { - auto object = new Object; - Ptr ptr(object); - auto ptr2 = std::move(ptr); - assert(!ptr); - assert(ptr2->counter == 1); - } - - // copy assign - { - auto object1 = new Object; - auto object2 = new Object; - Ptr ptr1(object1); - Ptr ptr2(object2); - - ptr1 = ptr2; - assert(ptr1->counter == 2); - assert(ptr2->counter == 2); - } - - // move assign - { - auto object1 = new Object; - auto object2 = new Object; - Ptr ptr1(object1); - Ptr ptr2(object2); - - ptr1 = std::move(ptr2); - assert(ptr1->counter == 1); - assert(!ptr2); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/thread/thread.threads/create_late.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/create_late.pass.cpp deleted file mode 100644 index 847b354..0000000 --- a/libcxx/test/libcxx-03/thread/thread.threads/create_late.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: no-threads -// UNSUPPORTED: c++03 - -#include "make_test_thread.h" - -void func() {} - -struct T { - ~T() { - // __thread_local_data is expected to be destroyed as it was created - // from the main(). Now trigger another access. - support::make_test_thread(func).join(); - } -} t; - -int main(int, char**) { - // Triggers construction of __thread_local_data. - support::make_test_thread(func).join(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/convert_to_tm.pass.cpp b/libcxx/test/libcxx-03/time/convert_to_tm.pass.cpp deleted file mode 100644 index 6e3fa62..0000000 --- a/libcxx/test/libcxx-03/time/convert_to_tm.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <chrono> - -// template <class _Tm, class _ChronoT> -// _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) - -// Most of the code is tested indirectly in the chrono formatters. This only -// tests the hour overflow. - -#include <__chrono/convert_to_tm.h> -#include <chrono> -#include <cassert> -#include <format> -#include <string_view> - -#include "test_macros.h" - -// libc++ uses a long as representation in std::chrono::hours. -// std::tm uses an int for its integral members. The overflow in the hour -// conversion can only occur on platforms where sizeof(long) > sizeof(int). -// Instead emulate this error by using a "tm" with shorts. -// (The function is already templated to this is quite easy to do,) -struct minimal_short_tm { - short tm_sec; - short tm_min; - short tm_hour; - const char* tm_zone; -}; - -int main(int, char**) { - { // Test with the maximum number of hours that fit in a short. - std::chrono::hh_mm_ss time{std::chrono::hours{32767}}; - minimal_short_tm result = std::__convert_to_tm<minimal_short_tm>(time); - assert(result.tm_sec == 0); - assert(result.tm_min == 0); - assert(result.tm_hour == 32767); - } - -#ifndef TEST_HAS_NO_EXCEPTIONS - { // Test above the maximum number of hours that fit in a short. - std::chrono::hh_mm_ss time{std::chrono::hours{32768}}; - try { - TEST_IGNORE_NODISCARD std::__convert_to_tm<minimal_short_tm>(time); - assert(false); - } catch ([[maybe_unused]] const std::format_error& e) { - LIBCPP_ASSERT(e.what() == std::string_view("Formatting hh_mm_ss, encountered an hour overflow")); - return 0; - } - assert(false); - } -#endif // TEST_HAS_NO_EXCEPTIONS - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.gps/time.clock.gps.members/assert.from_utc.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.gps/time.clock.gps.members/assert.from_utc.pass.cpp deleted file mode 100644 index d8200439..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.gps/time.clock.gps.members/assert.from_utc.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// REQUIRES: has-unix-headers -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <chrono> -// -// class gps_clock; - -// static gps_time<common_type_t<_Duration, seconds>> -// from_utc(const utc_time<_Duration>& t) noexcept; - -#include <chrono> - -#include "check_assertion.h" - -// The function is specified as -// gps_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 378691210s -// When t == t.max() there will be a signed integral overflow (other values too). -int main(int, char**) { - using namespace std::literals::chrono_literals; - constexpr std::chrono::seconds offset{315964809}; - - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::nanoseconds>::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::nanoseconds>::max() - offset + 1ns), - "the UTC to GPS conversion would overflow"); - - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::microseconds>::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::microseconds>::max() - offset + 1us), - "the UTC to GPS conversion would overflow"); - - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::milliseconds>::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::milliseconds>::max() - offset + 1ms), - "the UTC to GPS conversion would overflow"); - - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_seconds::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE(std::chrono::gps_clock::from_utc(std::chrono::utc_seconds::max() - offset + 1s), - "the UTC to GPS conversion would overflow"); - - // The conversion uses `common_type_t<Duration, seconds>` so types "larger" - // than seconds are converted to seconds. Types "larger" than seconds are - // stored in "smaller" intergral and the overflow can never occur. - - // Validate the types can never overflow on all current (and future) supported platforms. - static_assert(std::chrono::utc_time<std::chrono::days>::max() <= std::chrono::utc_seconds::max() - offset); - static_assert(std::chrono::utc_time<std::chrono::weeks>::max() <= std::chrono::utc_seconds::max() - offset); - static_assert(std::chrono::utc_time<std::chrono::months>::max() <= std::chrono::utc_seconds::max() - offset); - static_assert(std::chrono::utc_time<std::chrono::years>::max() <= std::chrono::utc_seconds::max() - offset); - - // Validate the run-time conversion works. - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::days>::max()); - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::weeks>::max()); - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::months>::max()); - (void)std::chrono::gps_clock::from_utc(std::chrono::utc_time<std::chrono::years>::max()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.gps/time.clock.gps.members/assert.to_utc.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.gps/time.clock.gps.members/assert.to_utc.pass.cpp deleted file mode 100644 index d61b337..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.gps/time.clock.gps.members/assert.to_utc.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// REQUIRES: has-unix-headers -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <chrono> -// -// class gps_clock; - -// static utc_time<common_type_t<_Duration, seconds>> -// to_utc(const gps_time<_Duration>& t) noexcept; - -#include <chrono> - -#include "check_assertion.h" - -// The function is specified as -// utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} - 378691210s -// When t == t.min() there will be a signed integral underlow (other values too). -int main(int, char**) { - using namespace std::literals::chrono_literals; - constexpr std::chrono::seconds offset{315964809}; - - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::nanoseconds>::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::nanoseconds>::min() + offset - 1ns), - "the GPS to UTC conversion would underflow"); - - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::microseconds>::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::microseconds>::min() + offset - 1us), - "the GPS to UTC conversion would underflow"); - - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::milliseconds>::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::milliseconds>::min() + offset - 1ms), - "the GPS to UTC conversion would underflow"); - - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_seconds::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE(std::chrono::gps_clock::to_utc(std::chrono::gps_seconds::min() + offset - 1s), - "the GPS to UTC conversion would underflow"); - - // The conversion uses `common_type_t<Duration, seconds>` so types "larger" - // than seconds are converted to seconds. Types "larger" than seconds are - // stored in "smaller" intergral and the underflow can never occur. - - // Validate the types can never underflow on all current (and future) supported platforms. - static_assert(std::chrono::gps_time<std::chrono::days>::min() >= std::chrono::gps_seconds::min() + offset); - static_assert(std::chrono::gps_time<std::chrono::weeks>::min() >= std::chrono::gps_seconds::min() + offset); - static_assert(std::chrono::gps_time<std::chrono::months>::min() >= std::chrono::gps_seconds::min() + offset); - static_assert(std::chrono::gps_time<std::chrono::years>::min() >= std::chrono::gps_seconds::min() + offset); - - // Validate the run-time conversion works. - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::days>::min()); - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::weeks>::min()); - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::months>::min()); - (void)std::chrono::gps_clock::to_utc(std::chrono::gps_time<std::chrono::years>::min()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.tai/time.clock.tai.members/assert.from_utc.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.tai/time.clock.tai.members/assert.from_utc.pass.cpp deleted file mode 100644 index f04595c..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.tai/time.clock.tai.members/assert.from_utc.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// REQUIRES: has-unix-headers -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <chrono> -// -// class tai_clock; - -// static tai_time<common_type_t<_Duration, seconds>> -// from_utc(const utc_time<_Duration>& t) noexcept; - -#include <chrono> - -#include "check_assertion.h" - -// The function is specified as -// tai_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 378691210s -// When t == t.max() there will be a signed integral overflow (other values too). -int main(int, char**) { - using namespace std::literals::chrono_literals; - constexpr std::chrono::seconds offset{378691210}; - - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::nanoseconds>::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::nanoseconds>::max() - offset + 1ns), - "the UTC to TAI conversion would overflow"); - - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::microseconds>::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::microseconds>::max() - offset + 1us), - "the UTC to TAI conversion would overflow"); - - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::milliseconds>::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::milliseconds>::max() - offset + 1ms), - "the UTC to TAI conversion would overflow"); - - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_seconds::max() - offset); - TEST_LIBCPP_ASSERT_FAILURE(std::chrono::tai_clock::from_utc(std::chrono::utc_seconds::max() - offset + 1s), - "the UTC to TAI conversion would overflow"); - - // The conversion uses `common_type_t<Duration, seconds>` so types "larger" - // than seconds are converted to seconds. Types "larger" than seconds are - // stored in "smaller" intergral and the overflow can never occur. - - // Validate the types can never overflow on all current (and future) supported platforms. - static_assert(std::chrono::utc_time<std::chrono::days>::max() <= std::chrono::utc_seconds::max() - offset); - static_assert(std::chrono::utc_time<std::chrono::weeks>::max() <= std::chrono::utc_seconds::max() - offset); - static_assert(std::chrono::utc_time<std::chrono::months>::max() <= std::chrono::utc_seconds::max() - offset); - static_assert(std::chrono::utc_time<std::chrono::years>::max() <= std::chrono::utc_seconds::max() - offset); - - // Validate the run-time conversion works. - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::days>::max()); - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::weeks>::max()); - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::months>::max()); - (void)std::chrono::tai_clock::from_utc(std::chrono::utc_time<std::chrono::years>::max()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.tai/time.clock.tai.members/assert.to_utc.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.tai/time.clock.tai.members/assert.to_utc.pass.cpp deleted file mode 100644 index 624c6c4..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.tai/time.clock.tai.members/assert.to_utc.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++20 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// REQUIRES: has-unix-headers -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// <chrono> -// -// class tai_clock; - -// static utc_time<common_type_t<_Duration, seconds>> -// to_utc(const tai_time<_Duration>& t) noexcept; - -#include <chrono> - -#include "check_assertion.h" - -// The function is specified as -// utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} - 378691210s -// When t == t.min() there will be a signed integral underlow (other values too). -int main(int, char**) { - using namespace std::literals::chrono_literals; - constexpr std::chrono::seconds offset{378691210}; - - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::nanoseconds>::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::nanoseconds>::min() + offset - 1ns), - "the TAI to UTC conversion would underflow"); - - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::microseconds>::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::microseconds>::min() + offset - 1us), - "the TAI to UTC conversion would underflow"); - - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::milliseconds>::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::milliseconds>::min() + offset - 1ms), - "the TAI to UTC conversion would underflow"); - - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_seconds::min() + offset); - TEST_LIBCPP_ASSERT_FAILURE(std::chrono::tai_clock::to_utc(std::chrono::tai_seconds::min() + offset - 1s), - "the TAI to UTC conversion would underflow"); - - // The conversion uses `common_type_t<Duration, seconds>` so types "larger" - // than seconds are converted to seconds. Types "larger" than seconds are - // stored in "smaller" intergral and the underflow can never occur. - - // Validate the types can never underflow on all current (and future) supported platforms. - static_assert(std::chrono::tai_time<std::chrono::days>::min() >= std::chrono::tai_seconds::min() + offset); - static_assert(std::chrono::tai_time<std::chrono::weeks>::min() >= std::chrono::tai_seconds::min() + offset); - static_assert(std::chrono::tai_time<std::chrono::months>::min() >= std::chrono::tai_seconds::min() + offset); - static_assert(std::chrono::tai_time<std::chrono::years>::min() >= std::chrono::tai_seconds::min() + offset); - - // Validate the run-time conversion works. - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::days>::min()); - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::weeks>::min()); - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::months>::min()); - (void)std::chrono::tai_clock::to_utc(std::chrono::tai_time<std::chrono::years>::min()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/get_leap_second_info.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/get_leap_second_info.pass.cpp deleted file mode 100644 index e87c543..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/get_leap_second_info.pass.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> -// -// class utc_clock; - -// template<class Duration> -// std::chrono::leap_second_info get_leap_second_info(const utc_time<Duration>& ut); - -#include <chrono> -#include <cassert> -#include <fstream> -#include <string> -#include <string_view> - -#include "test_macros.h" -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path tzdata = env.create_file("zoneinfo/tzdata.zi"); -const std::filesystem::path leap_seconds = env.create_file("zoneinfo/leap-seconds.list"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - { - std::ofstream f{tzdata}; - f << "# version " << version++ << '\n'; - std::ofstream{leap_seconds}.write(input.data(), input.size()); - } - std::chrono::reload_tzdb(); -} - -template <class Duration> -static void test_leap_second_info( - std::chrono::time_point<std::chrono::utc_clock, Duration> time, bool is_leap_second, std::chrono::seconds elapsed) { - std::chrono::leap_second_info result = std::chrono::get_leap_second_info(time); - TEST_REQUIRE( - result.is_leap_second == is_leap_second && result.elapsed == elapsed, - TEST_WRITE_CONCATENATED( - "\nExpected output [", - is_leap_second, - ", ", - elapsed, - "]\nActual output [", - result.is_leap_second, - ", ", - result.elapsed, - "]\n")); -} - -static void test_no_leap_seconds_entries() { - using namespace std::literals::chrono_literals; - - write(""); - - test_leap_second_info( - std::chrono::utc_seconds{std::chrono::sys_days{std::chrono::January / 1 / 1900}.time_since_epoch()}, false, 0s); - test_leap_second_info( - std::chrono::utc_seconds{std::chrono::sys_days{std::chrono::January / 1 / 2000}.time_since_epoch()}, false, 0s); - test_leap_second_info( - std::chrono::utc_seconds{std::chrono::sys_days{std::chrono::January / 1 / 3000}.time_since_epoch()}, false, 0s); -} - -// Note at the time of writing all leap seconds are positive. This test uses -// fake data to test the behaviour of negative leap seconds. -static void test_negative_leap_seconds() { - using namespace std::literals::chrono_literals; - - // Use small values for simplicity. The dates are seconds since 1.1.1900. - write( - R"( -1 10 -60 11 -120 12 -180 11 -240 12 -300 13 -360 12 -)"); - - // Transitions from the start of UTC. - auto test_transition = [](std::chrono::utc_seconds time, std::chrono::seconds elapsed, bool positive) { - if (positive) { - // Every transition has the following tests - // - 1ns before the start of the transition is_leap_second -> false, elapsed -> elapsed - // - at the start of the transition is_leap_second -> true, elapsed -> elapsed + 1 - // - 1ns after the start of the transition is_leap_second -> true, elapsed -> elapsed + 1 - // - 1ns before the end of the transition is_leap_second -> true, elapsed -> elapsed + 1 - // - at the end of the transition is_leap_second -> false, elapsed -> elapsed + 1 - - test_leap_second_info(time - 1ns, false, elapsed); - test_leap_second_info(time, true, elapsed + 1s); - test_leap_second_info(time + 1ns, true, elapsed + 1s); - test_leap_second_info(time + 1s - 1ns, true, elapsed + 1s); - test_leap_second_info(time + 1s, false, elapsed + 1s); - } else { - // Every transition has the following tests - // - 1ns before the transition is_leap_second -> false, elapsed -> elapsed - // - at the transition is_leap_second -> false elapsed -> elapsed - 1 - // - 1ns after the transition is_leap_second -> false, elapsed -> elapsed - 1 - test_leap_second_info(time - 1ns, false, elapsed); - test_leap_second_info(time, false, elapsed - 1s); - test_leap_second_info(time + 1ns, false, elapsed - 1s); - } - }; - - std::chrono::utc_seconds epoch{std::chrono::sys_days{std::chrono::January / 1 / 1900}.time_since_epoch()}; - test_leap_second_info(epoch, false, 0s); - - // The UTC times are: - // epoch + transition time in the database + leap seconds before the transition. - test_transition(epoch + 60s + 0s, 0s, true); - test_transition(epoch + 120s + 1s, 1s, true); - test_transition(epoch + 180s + 2s, 2s, false); - test_transition(epoch + 240s + 1s, 1s, true); - test_transition(epoch + 300s + 2s, 2s, true); - test_transition(epoch + 360s + 3s, 3s, false); -} - -int main(int, const char**) { - test_no_leap_seconds_entries(); - test_negative_leap_seconds(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/time.clock.utc.members/from_sys.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/time.clock.utc.members/from_sys.pass.cpp deleted file mode 100644 index 2468daa..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/time.clock.utc.members/from_sys.pass.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> -// -// class utc_clock; - -// template<class Duration> -// static utc_time<common_type_t<Duration, seconds>> -// from_sys(const sys_time<Duration>& time); - -#include <chrono> -#include <cassert> -#include <fstream> -#include <string> -#include <string_view> - -#include "test_macros.h" -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path tzdata = env.create_file("zoneinfo/tzdata.zi"); -const std::filesystem::path leap_seconds = env.create_file("zoneinfo/leap-seconds.list"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - std::ofstream f{tzdata}; - f << "# version " << version++ << '\n'; - std::ofstream{leap_seconds}.write(input.data(), input.size()); -} - -template <class Duration> -static void -test_leap_seconds(std::chrono::time_point<std::chrono::system_clock, Duration> time, std::chrono::seconds expected) { - auto utc = std::chrono::utc_clock::from_sys(time); - auto diff = utc.time_since_epoch() - time.time_since_epoch(); - TEST_REQUIRE( - diff == expected, - TEST_WRITE_CONCATENATED("\tTime: ", time, "\nExpected output ", expected, "\nActual output ", diff, '\n')); -} - -// Note at the time of writing all leap seconds are positive. This test uses -// fake data to test the behaviour of negative leap seconds. -int main(int, const char**) { - using namespace std::literals::chrono_literals; - - // Use small values for simplicity. The dates are seconds since 1.1.1970. - write( - R"( -1 10 -60 11 -120 12 -180 11 -240 12 -300 13 -360 12 -)"); - - std::chrono::sys_days epoch = {std::chrono::January / 1 / 1900}; - test_leap_seconds(epoch, 0s); - - test_leap_seconds(epoch + 60s - 1ns, 0s); - test_leap_seconds(epoch + 60s, 1s); - test_leap_seconds(epoch + 60s + 1ns, 1s); - - test_leap_seconds(epoch + 120s - 1ns, 1s); - test_leap_seconds(epoch + 120s, 2s); - test_leap_seconds(epoch + 120s + 1ns, 2s); - - test_leap_seconds(epoch + 180s - 1ns, 2s); - test_leap_seconds(epoch + 180s, 1s); - test_leap_seconds(epoch + 180s + 1ns, 1s); - - test_leap_seconds(epoch + 240s - 1ns, 1s); - test_leap_seconds(epoch + 240s, 2s); - test_leap_seconds(epoch + 240s + 1ns, 2s); - - test_leap_seconds(epoch + 300s - 1ns, 2s); - test_leap_seconds(epoch + 300s, 3s); - test_leap_seconds(epoch + 300s + 1ns, 3s); - - test_leap_seconds(epoch + 360s - 1ns, 3s); - test_leap_seconds(epoch + 360s, 2s); - test_leap_seconds(epoch + 360s + 1ns, 2s); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/time.clock.utc.members/to_sys.pass.cpp b/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/time.clock.utc.members/to_sys.pass.cpp deleted file mode 100644 index ab4dff4..0000000 --- a/libcxx/test/libcxx-03/time/time.clock/time.clock.utc/time.clock.utc.members/to_sys.pass.cpp +++ /dev/null @@ -1,117 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> -// -// class utc_clock; - -// static sys_time<common_type_t<_Duration, seconds>> -// to_sys(const utc_time<_Duration>& __time); - -#include <chrono> -#include <cassert> -#include <fstream> -#include <string> -#include <string_view> - -#include "test_macros.h" -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path tzdata = env.create_file("zoneinfo/tzdata.zi"); -const std::filesystem::path leap_seconds = env.create_file("zoneinfo/leap-seconds.list"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - std::ofstream f{tzdata}; - f << "# version " << version++ << '\n'; - std::ofstream{leap_seconds}.write(input.data(), input.size()); -} - -template <class Duration> -static void test_leap_seconds(std::chrono::utc_time<Duration> time, std::chrono::sys_time<Duration> expected) { - auto result = std::chrono::utc_clock::to_sys(time); - TEST_REQUIRE(result == expected, - TEST_WRITE_CONCATENATED("\nExpected output ", expected, "\nActual output ", result, '\n')); -} - -// Note at the time of writing all leap seconds are positive. This test uses -// fake data to test the behaviour of negative leap seconds. -int main(int, const char**) { - using namespace std::literals::chrono_literals; - - // Use small values for simplicity. The dates are seconds since 1.1.1970. - write( - R"( -1 10 -60 11 -120 12 -180 11 -240 12 -300 13 -360 12 -)"); - - std::chrono::sys_seconds sys_epoch{std::chrono::sys_days{std::chrono::January / 1 / 1900}}; - std::chrono::utc_seconds utc_epoch{sys_epoch.time_since_epoch()}; - - test_leap_seconds(utc_epoch, sys_epoch); - auto test_transition = [](std::chrono::sys_seconds sys, std::chrono::seconds elapsed, bool positive) { - std::chrono::utc_seconds utc = std::chrono::utc_seconds{sys.time_since_epoch()} + elapsed; - if (positive) { - // Every transition has the following tests - // - 1ns before the start of the transition no adjustment needed - // - at the start of the transition sys is clamped at the time just prior to the moment - // of the leap second insertion. The exact value depends - // on the resolution of the result type. - // - 1ns before the end of the transition sys is still clamped like before - // - at the end of the transition sys is 1s behind the utc time - // - 1ns after the end of the transition sys is still 1s behind the utc time - test_leap_seconds(utc - 1ns, sys - 1ns); - test_leap_seconds(utc, sys - 1s); - test_leap_seconds(utc + 0ns, sys - 1ns); - test_leap_seconds(utc + 1s - 1ns, sys - 1ns); - test_leap_seconds(utc + 1s, sys); - test_leap_seconds(utc + 1s + 0ns, sys + 0ns); - test_leap_seconds(utc + 1s + 1ns, sys + 1ns); - } else { - // Every transition has the following tests - // - 1ns before the transition no adjustment needed - // - at the transition sys is 1s ahead of the utc time - // - 1ns after the transition sys is still 1s ahead of the utc time - test_leap_seconds(utc - 1ns, sys - 1ns); - test_leap_seconds(utc, sys + 1s); - test_leap_seconds(utc + 1ns, sys + 1s + 1ns); - } - }; - - test_transition(sys_epoch + 60s, 0s, true); - test_transition(sys_epoch + 120s, 1s, true); - test_transition(sys_epoch + 180s, 2s, false); - test_transition(sys_epoch + 240s, 1s, true); - test_transition(sys_epoch + 300s, 2s, true); - test_transition(sys_epoch + 360s, 3s, false); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/leap_seconds.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/leap_seconds.pass.cpp deleted file mode 100644 index d7ae219..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/leap_seconds.pass.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// Tests the IANA database leap seconds parsing and operations. -// This is not part of the public tzdb interface. - -#include <cassert> -#include <chrono> -#include <fstream> -#include <string> -#include <string_view> - -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path tzdata = env.create_file("zoneinfo/tzdata.zi"); -const std::filesystem::path leap_seconds = env.create_file("zoneinfo/leap-seconds.list"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -void write(std::string_view input) { - static int version = 0; - - std::ofstream f{tzdata}; - f << "# version " << version++ << '\n'; - std::ofstream{leap_seconds}.write(input.data(), input.size()); -} - -static const std::chrono::tzdb& parse(std::string_view input) { - write(input); - return std::chrono::reload_tzdb(); -} - -static void test_exception(std::string_view input, [[maybe_unused]] std::string_view what) { - write(input); - - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD std::chrono::reload_tzdb()); -} - -static void test_invalid() { - test_exception("0", "corrupt tzdb: expected a non-zero digit"); - - test_exception("1", "corrupt tzdb: expected whitespace"); - - test_exception("1 ", "corrupt tzdb: expected a non-zero digit"); - - test_exception("5764607523034234880 2", "corrupt tzdb: integral too large"); -} - -static void test_leap_seconds() { - using namespace std::chrono; - - // Test whether loading also sorts the entries in the proper order. - const tzdb& result = parse( - R"( -2303683200 12 # 1 Jan 1973 -2287785600 11 # 1 Jul 1972 -2272060800 10 # 1 Jan 1972 -86400 9 # 2 Jan 1900 Dummy entry to test before 1970 -1 8 # 2 Jan 1900 Dummy entry to test before 1970 - -# Fictional negative leap second -2303769600 11 # 2 Jan 1973 - -# largest accepted value by the parser -5764607523034234879 12 -)"); - - assert(result.leap_seconds.size() == 6); - - assert(result.leap_seconds[0].date() == sys_seconds{sys_days{1900y / January / 2}}); - assert(result.leap_seconds[0].value() == 1s); - - assert(result.leap_seconds[1].date() == sys_seconds{sys_days{1972y / January / 1}}); - assert(result.leap_seconds[1].value() == 1s); - - assert(result.leap_seconds[2].date() == sys_seconds{sys_days{1972y / July / 1}}); - assert(result.leap_seconds[2].value() == 1s); - - assert(result.leap_seconds[3].date() == sys_seconds{sys_days{1973y / January / 1}}); - assert(result.leap_seconds[3].value() == 1s); - - assert(result.leap_seconds[4].date() == sys_seconds{sys_days{1973y / January / 2}}); - assert(result.leap_seconds[4].value() == -1s); - - assert(result.leap_seconds[5].date() == - sys_seconds{5764607523034234879s - // The database uses 1900-01-01 as epoch. - - std::chrono::duration_cast<std::chrono::seconds>( - sys_days{1970y / January / 1} - sys_days{1900y / January / 1})}); - assert(result.leap_seconds[5].value() == 1s); -} - -int main(int, const char**) { - test_invalid(); - test_leap_seconds(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/links.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/links.pass.cpp deleted file mode 100644 index 9bace25..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/links.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// Tests the IANA database rules links and operations. -// This is not part of the public tzdb interface. - -#include <chrono> - -#include <cassert> -#include <chrono> -#include <fstream> -#include <string> -#include <string_view> - -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path file = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -void write(std::string_view input) { - static int version = 0; - - std::ofstream f{file}; - f << "# version " << version++ << '\n'; - f.write(input.data(), input.size()); -} - -static const std::chrono::tzdb& parse(std::string_view input) { - write(input); - return std::chrono::reload_tzdb(); -} - -static void test_exception(std::string_view input, [[maybe_unused]] std::string_view what) { - write(input); - - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD std::chrono::reload_tzdb()); -} - -static void test_invalid() { - test_exception("L", "corrupt tzdb: expected whitespace"); - - test_exception("L ", "corrupt tzdb: expected a string"); - - test_exception("L n", "corrupt tzdb: expected whitespace"); - - test_exception("L n ", "corrupt tzdb: expected a string"); -} - -static void test_link() { - const std::chrono::tzdb& result = parse( - R"( -L z d -l b a -lInK b b -)"); - assert(result.links.size() == 3); - - assert(result.links[0].name() == "a"); - assert(result.links[0].target() == "b"); - - assert(result.links[1].name() == "b"); - assert(result.links[1].target() == "b"); - - assert(result.links[2].name() == "d"); - assert(result.links[2].target() == "z"); -} - -int main(int, const char**) { - test_invalid(); - test_link(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/rules.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/rules.pass.cpp deleted file mode 100644 index 237a206..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/rules.pass.cpp +++ /dev/null @@ -1,594 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// Tests the IANA database rules parsing and operations. -// This is not part of the public tzdb interface. -// The test uses private implementation headers. -// ADDITIONAL_COMPILE_FLAGS: -I %{libcxx-dir}/src/experimental/include - -#include <chrono> -#include <cstdio> -#include <fstream> -#include <string_view> -#include <string> -#include <variant> - -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -// headers in the dylib -#include "tzdb/types_private.h" -#include "tzdb/tzdb_private.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path file = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - std::ofstream f{file}; - f << "# version " << version++ << '\n'; - f.write(input.data(), input.size()); -} - -struct parse_result { - explicit parse_result(std::string_view input) { - write(input); - std::chrono::tzdb tzdb; // result not needed for the tests. - std::chrono::__init_tzdb(tzdb, rules); - } - std::chrono::__tz::__rules_storage_type rules; -}; - -static void test_exception(std::string_view input, [[maybe_unused]] std::string_view what) { - write(input); - - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD std::chrono::reload_tzdb()); -} - -static void test_invalid() { - test_exception("R", "corrupt tzdb: expected whitespace"); - - test_exception("R ", "corrupt tzdb: expected a string"); - - test_exception("R r", "corrupt tzdb: expected whitespace"); - - test_exception("R r x", "corrupt tzdb: expected a digit"); - test_exception("R r +", "corrupt tzdb: expected a digit"); - test_exception("R r mx", "corrupt tzdb year: expected 'min' or 'max'"); - test_exception("R r -32768", "corrupt tzdb year: year is less than the minimum"); - test_exception("R r 32768", "corrupt tzdb year: year is greater than the maximum"); - - test_exception("R r mix", "corrupt tzdb: expected whitespace"); - test_exception("R r 0", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 x", "corrupt tzdb: expected a digit"); - test_exception("R r 0 +", "corrupt tzdb: expected a digit"); - test_exception("R r 0 mx", "corrupt tzdb year: expected 'min' or 'max'"); - - test_exception("R r 0 mix", "corrupt tzdb: expected whitespace"); - test_exception("R r 0 1", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 1 X", "corrupt tzdb: expected character '-', got 'X' instead"); - - test_exception("R r 0 1 -", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 1 - j", "corrupt tzdb month: invalid name"); - - test_exception("R r 0 1 - Ja", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 1 - Ja +", "corrupt tzdb weekday: invalid name"); - test_exception("R r 0 1 - Ja 32", "corrupt tzdb day: value too large"); - test_exception( - "R r 0 1 - Ja l", - std::string{"corrupt tzdb: expected character 'a' from string 'last', got '"} + (char)EOF + "' instead"); - test_exception("R r 0 1 - Ja last", "corrupt tzdb weekday: invalid name"); - test_exception("R r 0 1 - Ja lastS", "corrupt tzdb weekday: invalid name"); - test_exception("R r 0 1 - Ja S", "corrupt tzdb weekday: invalid name"); - test_exception("R r 0 1 - Ja Su", "corrupt tzdb on: expected '>=' or '<='"); - test_exception( - "R r 0 1 - Ja Su>", std::string{"corrupt tzdb: expected character '=', got '"} + (char)EOF + "' instead"); - test_exception( - "R r 0 1 - Ja Su<", std::string{"corrupt tzdb: expected character '=', got '"} + (char)EOF + "' instead"); - test_exception("R r 0 1 - Ja Su>=+", "corrupt tzdb: expected a non-zero digit"); - test_exception("R r 0 1 - Ja Su>=0", "corrupt tzdb: expected a non-zero digit"); - test_exception("R r 0 1 - Ja Su>=32", "corrupt tzdb day: value too large"); - - test_exception("R r 0 1 - Ja Su>=31", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 1 - Ja Su>=31 ", "corrupt tzdb: expected a digit"); - test_exception("R r 0 1 - Ja Su>=31 +", "corrupt tzdb: expected a digit"); - - test_exception("R r 0 1 - Ja Su>=31 1", "corrupt tzdb: expected whitespace"); - test_exception("R r 0 1 - Ja Su>=31 1a", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 1 - Ja Su>=31 1w 2", "corrupt tzdb: expected whitespace"); - test_exception("R r 0 1 - Ja Su>=31 1w 2a", "corrupt tzdb: expected whitespace"); - - test_exception("R r 0 1 - Ja Su>=31 1w 2s", "corrupt tzdb: expected whitespace"); - test_exception("R r 0 1 - Ja Su>=31 1w 2s ", "corrupt tzdb: expected a string"); -} - -static void test_name() { - parse_result result{ - R"( -R z 0 1 - Ja Su>=31 1w 2s - -rULE z 0 1 - Ja Su>=31 1w 2s - -RuLe z 0 1 - Ja Su>=31 1w 2s - -R a 0 1 - Ja Su>=31 1w 2s - -R a 0 1 - Ja Su>=31 1w 2s - -)"}; - - assert(result.rules.size() == 2); - assert(result.rules[0].first == "a"); - assert(result.rules[0].second.size() == 2); - assert(result.rules[1].first == "z"); - assert(result.rules[1].second.size() == 3); -} - -static void test_from() { - parse_result result{ - R"( -# min abbreviations -R a M 1 - Ja Su>=31 1w 2s - -R a mI 1 - Ja Su>=31 1w 2s - -R a mIN 1 - Ja Su>=31 1w 2s - - -# max abbrviations -R a MA 1 - Ja Su>=31 1w 2s - -R a mAx 1 - Ja Su>=31 1w 2s - - -R a -1000 1 - Ja Su>=31 1w 2s - -R a -100 1 - Ja Su>=31 1w 2s - -R a 0000 1 - Ja Su>=31 1w 2s - -R a 100 1 - Ja Su>=31 1w 2s - -R a 1000 1 - Ja Su>=31 1w 2s - -)"}; - - assert(result.rules.size() == 1); - assert(result.rules[0].second.size() == 10); - - assert(result.rules[0].second[0].__from == std::chrono::year::min()); - assert(result.rules[0].second[1].__from == std::chrono::year::min()); - assert(result.rules[0].second[2].__from == std::chrono::year::min()); - - assert(result.rules[0].second[3].__from == std::chrono::year::max()); - assert(result.rules[0].second[4].__from == std::chrono::year::max()); - - assert(result.rules[0].second[5].__from == std::chrono::year(-1000)); - assert(result.rules[0].second[6].__from == std::chrono::year(-100)); - assert(result.rules[0].second[7].__from == std::chrono::year(0)); - assert(result.rules[0].second[8].__from == std::chrono::year(100)); - assert(result.rules[0].second[9].__from == std::chrono::year(1000)); -} - -static void test_to() { - parse_result result{ - R"( -# min abbreviations -R a 0 m - Ja Su>=31 1w 2s - -R a 0 mi - Ja Su>=31 1w 2s - -R a 0 min - Ja Su>=31 1w 2s - - -# max abbrviations -R a 0 ma - Ja Su>=31 1w 2s - -R a 0 max - Ja Su>=31 1w 2s - - -R a 0 -1000 - Ja Su>=31 1w 2s - -R a 0 -100 - Ja Su>=31 1w 2s - -R a 0 0000 - Ja Su>=31 1w 2s - -R a 0 100 - Ja Su>=31 1w 2s - -R a 0 1000 - Ja Su>=31 1w 2s - - -# only abbreviations -R a m O - Ja Su>=31 1w 2s - -R a ma oN - Ja Su>=31 1w 2s - -R a -100 onL - Ja Su>=31 1w 2s - -R a 100 oNlY - Ja Su>=31 1w 2s - -)"}; - - assert(result.rules.size() == 1); - assert(result.rules[0].second.size() == 14); - - assert(result.rules[0].second[0].__to == std::chrono::year::min()); - assert(result.rules[0].second[1].__to == std::chrono::year::min()); - assert(result.rules[0].second[2].__to == std::chrono::year::min()); - - assert(result.rules[0].second[3].__to == std::chrono::year::max()); - assert(result.rules[0].second[4].__to == std::chrono::year::max()); - - assert(result.rules[0].second[5].__to == std::chrono::year(-1000)); - assert(result.rules[0].second[6].__to == std::chrono::year(-100)); - assert(result.rules[0].second[7].__to == std::chrono::year(0)); - assert(result.rules[0].second[8].__to == std::chrono::year(100)); - assert(result.rules[0].second[9].__to == std::chrono::year(1000)); - - assert(result.rules[0].second[10].__to == std::chrono::year::min()); - assert(result.rules[0].second[11].__to == std::chrono::year::max()); - assert(result.rules[0].second[12].__to == std::chrono::year(-100)); - assert(result.rules[0].second[13].__to == std::chrono::year(100)); -} - -static void test_in() { - parse_result result{ - R"( -# All tests in alphabetic order to validate shortest unique abbreviation - -# Shortest abbreviation valid -R s 0 1 - ap Su>=31 1w 2s - -R s 0 1 - au Su>=31 1w 2s - -R s 0 1 - d Su>=31 1w 2s - -R s 0 1 - f Su>=31 1w 2s - -R s 0 1 - ja Su>=31 1w 2s - -R s 0 1 - jul Su>=31 1w 2s - -R s 0 1 - jun Su>=31 1w 2s - -R s 0 1 - May Su>=31 1w 2s - -R s 0 1 - mar Su>=31 1w 2s - -R s 0 1 - n Su>=31 1w 2s - -R s 0 1 - o Su>=31 1w 2s - -R s 0 1 - s Su>=31 1w 2s - - -# 3 letter abbreviation -R a 0 1 - APR Su>=31 1w 2s - -R a 0 1 - AUG Su>=31 1w 2s - -R a 0 1 - DEC Su>=31 1w 2s - -R a 0 1 - FEB Su>=31 1w 2s - -R a 0 1 - JAN Su>=31 1w 2s - -R a 0 1 - JUL Su>=31 1w 2s - -R a 0 1 - JUN Su>=31 1w 2s - -R a 0 1 - MAY Su>=31 1w 2s - -R a 0 1 - MAR Su>=31 1w 2s - -R a 0 1 - NOV Su>=31 1w 2s - -R a 0 1 - OCT Su>=31 1w 2s - -R a 0 1 - SEP Su>=31 1w 2s - - -# Full names -R f 0 1 - ApRiL Su>=31 1w 2s - -R f 0 1 - AuGuSt Su>=31 1w 2s - -R f 0 1 - DeCeMber Su>=31 1w 2s - -R f 0 1 - FeBrUary Su>=31 1w 2s - -R f 0 1 - JaNuAry Su>=31 1w 2s - -R f 0 1 - JuLy Su>=31 1w 2s - -R f 0 1 - JuNe Su>=31 1w 2s - -R f 0 1 - MaY Su>=31 1w 2s - -R f 0 1 - MaRch Su>=31 1w 2s - -R f 0 1 - NoVemBeR Su>=31 1w 2s - -R f 0 1 - OcTobEr Su>=31 1w 2s - -R f 0 1 - SePteMbEr Su>=31 1w 2s - -)"}; - - assert(result.rules.size() == 3); - for (std::size_t i = 0; i < result.rules.size(); ++i) { - assert(result.rules[i].second.size() == 12); - - assert(result.rules[i].second[0].__in == std::chrono::April); - assert(result.rules[i].second[1].__in == std::chrono::August); - assert(result.rules[i].second[2].__in == std::chrono::December); - assert(result.rules[i].second[3].__in == std::chrono::February); - assert(result.rules[i].second[4].__in == std::chrono::January); - assert(result.rules[i].second[5].__in == std::chrono::July); - assert(result.rules[i].second[6].__in == std::chrono::June); - assert(result.rules[i].second[7].__in == std::chrono::May); - assert(result.rules[i].second[8].__in == std::chrono::March); - assert(result.rules[i].second[9].__in == std::chrono::November); - assert(result.rules[i].second[10].__in == std::chrono::October); - assert(result.rules[i].second[11].__in == std::chrono::September); - } -}; - -static void test_on_day() { - parse_result result{ - R"( -# The parser does not validate the day as valid day of month -R a 0 1 - Fe 1 1w 2s - -R a 0 1 - Fe 10 1w 2s - -R a 0 1 - Fe 20 1w 2s - -R a 0 1 - Fe 30 1w 2s - -R a 0 1 - Fe 31 1w 2s - -)"}; - - assert(result.rules.size() == 1); - assert(result.rules[0].second.size() == 5); - assert(std::get<std::chrono::day>(result.rules[0].second[0].__on) == std::chrono::day(1)); - assert(std::get<std::chrono::day>(result.rules[0].second[1].__on) == std::chrono::day(10)); - assert(std::get<std::chrono::day>(result.rules[0].second[2].__on) == std::chrono::day(20)); - assert(std::get<std::chrono::day>(result.rules[0].second[3].__on) == std::chrono::day(30)); - assert(std::get<std::chrono::day>(result.rules[0].second[4].__on) == std::chrono::day(31)); -} - -static void test_on_last() { - parse_result result{ - R"( -# All tests in alphabetic order to validate shortest unique abbreviation - -# Shortest abbreviation valid -R s 0 1 - Ja lastF 1w 2s - -R s 0 1 - Ja lastM 1w 2s - -R s 0 1 - Ja lastSa 1w 2s - -R s 0 1 - Ja lastSu 1w 2s - -R s 0 1 - Ja lastTh 1w 2s - -R s 0 1 - Ja lastTu 1w 2s - -R s 0 1 - Ja lastW 1w 2s - - -# 3 letter abbreviation -R a 0 1 - Ja lastFri 1w 2s - -R a 0 1 - Ja lastMon 1w 2s - -R a 0 1 - Ja lastSat 1w 2s - -R a 0 1 - Ja lastSun 1w 2s - -R a 0 1 - Ja lastThu 1w 2s - -R a 0 1 - Ja lastTue 1w 2s - -R a 0 1 - Ja lastWed 1w 2s - - -# Full names -R f 0 1 - Ja lastFriday 1w 2s - -R f 0 1 - Ja lastMonday 1w 2s - -R f 0 1 - Ja lastSaturday 1w 2s - -R f 0 1 - Ja lastSunday 1w 2s - -R f 0 1 - Ja lastThursday 1w 2s - -R f 0 1 - Ja lastTuesday 1w 2s - -R f 0 1 - Ja lastWednesday 1w 2s - -)"}; - - assert(result.rules.size() == 3); - for (std::size_t i = 0; i < result.rules.size(); ++i) { - assert(result.rules[i].second.size() == 7); - - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[0].__on) == - std::chrono::weekday_last(std::chrono::Friday)); - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[1].__on) == - std::chrono::weekday_last(std::chrono::Monday)); - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[2].__on) == - std::chrono::weekday_last(std::chrono::Saturday)); - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[3].__on) == - std::chrono::weekday_last(std::chrono::Sunday)); - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[4].__on) == - std::chrono::weekday_last(std::chrono::Thursday)); - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[5].__on) == - std::chrono::weekday_last(std::chrono::Tuesday)); - assert(std::get<std::chrono::weekday_last>(result.rules[i].second[6].__on) == - std::chrono::weekday_last(std::chrono::Wednesday)); - } -} - -static void test_on_constrain() { - parse_result result{ - R"( -# Shortest abbreviation valid -R s 0 1 - Ja F>=1 1w 2s - -R s 0 1 - Ja M<=1 1w 2s - -R s 0 1 - Ja Sa>=31 1w 2s - -R s 0 1 - Ja Su<=31 1w 2s - -R s 0 1 - Ja Th>=10 1w 2s - -R s 0 1 - Ja Tu<=20 1w 2s - -R s 0 1 - Ja W>=30 1w 2s - - -# 3 letter abbreviation -R a 0 1 - Ja Fri>=1 1w 2s - -R a 0 1 - Ja Mon<=1 1w 2s - -R a 0 1 - Ja Sat>=31 1w 2s - -R a 0 1 - Ja Sun<=31 1w 2s - -R a 0 1 - Ja Thu>=10 1w 2s - -R a 0 1 - Ja Tue<=20 1w 2s - -R a 0 1 - Ja Wed>=30 1w 2s - - -# Full names -R f 0 1 - Ja Friday>=1 1w 2s - -R f 0 1 - Ja Monday<=1 1w 2s - -R f 0 1 - Ja Saturday>=31 1w 2s - -R f 0 1 - Ja Sunday<=31 1w 2s - -R f 0 1 - Ja Thursday>=10 1w 2s - -R f 0 1 - Ja Tuesday<=20 1w 2s - -R f 0 1 - Ja Wednesday>=30 1w 2s - - -)"}; - - std::chrono::__tz::__constrained_weekday r; - assert(result.rules.size() == 3); - for (std::size_t i = 0; i < result.rules.size(); ++i) { - assert(result.rules[i].second.size() == 7); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[0].__on); - assert(r.__weekday == std::chrono::Friday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__ge); - assert(r.__day == std::chrono::day(1)); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[1].__on); - assert(r.__weekday == std::chrono::Monday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__le); - assert(r.__day == std::chrono::day(1)); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[2].__on); - assert(r.__weekday == std::chrono::Saturday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__ge); - assert(r.__day == std::chrono::day(31)); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[3].__on); - assert(r.__weekday == std::chrono::Sunday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__le); - assert(r.__day == std::chrono::day(31)); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[4].__on); - assert(r.__weekday == std::chrono::Thursday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__ge); - assert(r.__day == std::chrono::day(10)); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[5].__on); - assert(r.__weekday == std::chrono::Tuesday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__le); - assert(r.__day == std::chrono::day(20)); - - r = std::get<std::chrono::__tz::__constrained_weekday>(result.rules[i].second[6].__on); - assert(r.__weekday == std::chrono::Wednesday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__ge); - assert(r.__day == std::chrono::day(30)); - } -} - -static void test_on() { - test_on_day(); - test_on_last(); - test_on_constrain(); -} - -static void test_at() { - parse_result result{ - R"( -# Based on the examples in the man page. -# Note the input is not expected to have fractional seconds, they are truncated. -R a 0 1 - Ja Su>=31 2w 2s - -R a 0 1 - Ja Su>=31 2:00s 2s - -R a 0 1 - Ja Su>=31 01:28:14u 2s - -R a 0 1 - Ja Su>=31 00:19:32.10g 2s - -R a 0 1 - Ja Su>=31 12:00z 2s - -R a 0 1 - Ja Su>=31 15:00 2s - -R a 0 1 - Ja Su>=31 24:00 2s - -R a 0 1 - Ja Su>=31 260:00 2s - -R a 0 1 - Ja Su>=31 -2:30 2s - -R a 0 1 - Ja Su>=31 - 2s - -)"}; - - assert(result.rules.size() == 1); - assert(result.rules[0].second.size() == 10); - - assert(result.rules[0].second[0].__at.__time == std::chrono::hours(2)); - assert(result.rules[0].second[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(result.rules[0].second[1].__at.__time == std::chrono::hours(2)); - assert(result.rules[0].second[1].__at.__clock == std::chrono::__tz::__clock::__standard); - - assert(result.rules[0].second[2].__at.__time == - std::chrono::hours(1) + std::chrono::minutes(28) + std::chrono::seconds(14)); - assert(result.rules[0].second[2].__at.__clock == std::chrono::__tz::__clock::__universal); - - assert(result.rules[0].second[3].__at.__time == std::chrono::minutes(19) + std::chrono::seconds(32)); - assert(result.rules[0].second[3].__at.__clock == std::chrono::__tz::__clock::__universal); - - assert(result.rules[0].second[4].__at.__time == std::chrono::hours(12)); - assert(result.rules[0].second[4].__at.__clock == std::chrono::__tz::__clock::__universal); - - assert(result.rules[0].second[5].__at.__time == std::chrono::hours(15)); - assert(result.rules[0].second[5].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(result.rules[0].second[6].__at.__time == std::chrono::hours(24)); - assert(result.rules[0].second[6].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(result.rules[0].second[7].__at.__time == std::chrono::hours(260)); - assert(result.rules[0].second[7].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(result.rules[0].second[8].__at.__time == -(std::chrono::hours(2) + std::chrono::minutes(30))); - assert(result.rules[0].second[8].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(result.rules[0].second[9].__at.__time == std::chrono::hours(0)); // The man page expresses it in hours - assert(result.rules[0].second[9].__at.__clock == std::chrono::__tz::__clock::__local); -} - -static void test_save() { - parse_result result{ - R"( -R a 0 1 - Ja Su>=31 1w 2d - -R a 0 1 - Ja Su>=31 1w 2:00s - -R a 0 1 - Ja Su>=31 1w 0 - -R a 0 1 - Ja Su>=31 1w 0:00:01 - -R a 0 1 - Ja Su>=31 1w -0:00:01 - -)"}; - - assert(result.rules.size() == 1); - assert(result.rules[0].second.size() == 5); - - assert(result.rules[0].second[0].__save.__time == std::chrono::hours(2)); - assert(result.rules[0].second[0].__save.__is_dst == true); - - assert(result.rules[0].second[1].__save.__time == std::chrono::hours(2)); - assert(result.rules[0].second[1].__save.__is_dst == false); - - assert(result.rules[0].second[2].__save.__time == std::chrono::hours(0)); - assert(result.rules[0].second[2].__save.__is_dst == false); - - assert(result.rules[0].second[3].__save.__time == std::chrono::seconds(1)); - assert(result.rules[0].second[3].__save.__is_dst == true); - - assert(result.rules[0].second[4].__save.__time == -std::chrono::seconds(1)); - assert(result.rules[0].second[4].__save.__is_dst == true); -} - -static void test_letter() { - parse_result result{ - R"( -R a 0 1 - Ja Su>=31 1w 2s - -R a 0 1 - Ja Su>=31 1w 2s a -R a 0 1 - Ja Su>=31 1w 2s abc -)"}; - - assert(result.rules.size() == 1); - assert(result.rules[0].second.size() == 3); - - assert(result.rules[0].second[0].__letters == ""); - assert(result.rules[0].second[1].__letters == "a"); - assert(result.rules[0].second[2].__letters == "abc"); -} - -static void test_mixed_order() { - // This is a part of the real database. The interesting part is that the - // rules NZ and Chatham are interleaved. Make sure the parse algorithm - // handles this correctly. - parse_result result{ - R"( -# Since 1957 Chatham has been 45 minutes ahead of NZ, but until 2018a -# there was no documented single notation for the date and time of this -# transition. Duplicate the Rule lines for now, to give the 2018a change -# time to percolate out. -Rule NZ 1974 only - Nov Sun>=1 2:00s 1:00 D -Rule Chatham 1974 only - Nov Sun>=1 2:45s 1:00 - -Rule NZ 1975 only - Feb lastSun 2:00s 0 S -Rule Chatham 1975 only - Feb lastSun 2:45s 0 - -Rule NZ 1975 1988 - Oct lastSun 2:00s 1:00 D -Rule Chatham 1975 1988 - Oct lastSun 2:45s 1:00 - -)"}; - - assert(result.rules.size() == 2); - assert(result.rules[0].second.size() == 3); - assert(result.rules[1].second.size() == 3); -} - -int main(int, const char**) { - test_invalid(); - test_name(); - test_from(); - test_to(); - test_in(); - test_on(); - test_at(); - test_save(); - test_letter(); - test_mixed_order(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.list/erase_after.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.list/erase_after.pass.cpp deleted file mode 100644 index 9284280..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.list/erase_after.pass.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> -// -// class tzdb_list; -// -// const_iterator erase_after(const_iterator p); - -#include <cassert> -#include <chrono> -#include <fstream> -#include <iterator> - -#include "filesystem_test_helper.h" -#include "test_macros.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path data = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { std::ofstream{data}.write(input.data(), input.size()); } - -int main(int, const char**) { - write("# version 1"); - std::chrono::tzdb_list& list = std::chrono::get_tzdb_list(); // [1] - - write("# version 2"); - std::chrono::reload_tzdb(); // [2, 1] - - assert(std::distance(list.begin(), list.end()) == 2); - assert(list.front().version == "2"); - - list.erase_after(list.begin()); // [2] - assert(std::distance(list.begin(), list.end()) == 1); - assert(list.front().version == "2"); - - write("# version 3"); - std::chrono::reload_tzdb(); // [3, 2] - assert(std::distance(list.begin(), list.end()) == 2); - - write("# version 4"); - std::chrono::reload_tzdb(); // [4, 3, 2] - assert(std::distance(list.begin(), list.end()) == 3); - assert(list.front().version == "4"); - - std::chrono::tzdb_list::const_iterator it = ++list.begin(); - assert(it->version == "3"); - - list.erase_after(it); // [4, 3] - assert(std::distance(list.begin(), list.end()) == 2); - assert(list.front().version == "4"); - assert(it->version == "3"); -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.remote/reload_tzdb.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.remote/reload_tzdb.pass.cpp deleted file mode 100644 index 5da4c7e..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.remote/reload_tzdb.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// const tzdb& reload_tzdb(); - -#include <cassert> -#include <chrono> -#include <fstream> -#include <iterator> - -#include "filesystem_test_helper.h" -#include "test_macros.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path data = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { std::ofstream{data}.write(input.data(), input.size()); } - -int main(int, const char**) { - write("# version old_version"); - const std::chrono::tzdb_list& list = std::chrono::get_tzdb_list(); - std::string version = "new_version"; - - assert(list.front().version == "old_version"); - assert(std::distance(list.begin(), list.end()) == 1); - assert(std::distance(list.cbegin(), list.cend()) == 1); - - write("# version new_version"); - assert(std::chrono::remote_version() == version); - - std::chrono::reload_tzdb(); - - assert(std::distance(list.begin(), list.end()) == 2); - assert(std::distance(list.cbegin(), list.cend()) == 2); - assert(list.front().version == version); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.tzdb/locate_zone.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.tzdb/locate_zone.pass.cpp deleted file mode 100644 index 08c6829..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/time.zone.db.tzdb/locate_zone.pass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// struct tzdb - -// const time_zone* locate_zone(string_view tz_name) const; - -#include <cassert> -#include <chrono> -#include <fstream> -#include <string_view> - -#include "test_macros.h" -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path file = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -void write(std::string_view input) { - static int version = 0; - - std::ofstream f{file}; - f << "# version " << version++ << '\n'; - f.write(input.data(), input.size()); -} - -static const std::chrono::tzdb& parse(std::string_view input) { - write(input); - return std::chrono::reload_tzdb(); -} - -int main(int, const char**) { - const std::chrono::tzdb& tzdb = parse( - R"( -Z zone 0 r f -L zone link -L link link_to_link -)"); - - { - const std::chrono::time_zone* tz = tzdb.locate_zone("zone"); - assert(tz); - assert(tz->name() == "zone"); - } - { - const std::chrono::time_zone* tz = tzdb.locate_zone("link"); - assert(tz); - assert(tz->name() == "zone"); - } - - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - [[maybe_unused]] std::string_view what{"tzdb: requested time zone not found"}; - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD tzdb.locate_zone("link_to_link")); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/version.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/version.pass.cpp deleted file mode 100644 index ca3a890f..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/version.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// Tests the IANA database version parsing. -// This is not part of the public tzdb interface. - -#include <chrono> -#include <cstdio> -#include <fstream> -#include <string_view> -#include <string> - -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path data = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void test(std::string_view input, std::string_view expected) { - std::ofstream{data}.write(input.data(), input.size()); - std::string version = std::chrono::remote_version(); - - TEST_REQUIRE( - version == expected, - TEST_WRITE_CONCATENATED( - "\nInput ", input, "\nExpected version ", expected, "\nActual version ", version, '\n')); -} - -static void test_exception(std::string_view input, [[maybe_unused]] std::string_view what) { - std::ofstream{data}.write(input.data(), input.size()); - - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD std::chrono::remote_version()); -} - -int main(int, const char**) { - test_exception("", std::string{"corrupt tzdb: expected character '#', got '"} + (char)EOF + "' instead"); - test_exception("#version", "corrupt tzdb: expected whitespace"); - test("#version \t ABCD", "ABCD"); - test("#Version \t ABCD", "ABCD"); - test("#vErsion \t ABCD", "ABCD"); - test("#verSion \t ABCD", "ABCD"); - test("#VERSION \t ABCD", "ABCD"); - test("# \t version \t 2023a", "2023a"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/zones.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.db/zones.pass.cpp deleted file mode 100644 index ded89ed..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.db/zones.pass.cpp +++ /dev/null @@ -1,380 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// Tests the IANA database zones parsing and operations. -// This is not part of the public tzdb interface. -// The test uses private implementation headers. -// ADDITIONAL_COMPILE_FLAGS: -I %{libcxx-dir}/src/experimental/include - -#include <cassert> -#include <chrono> -#include <fstream> -#include <string> -#include <string_view> -#include <variant> - -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -// headers in the dylib -#include "tzdb/types_private.h" -#include "tzdb/tzdb_private.h" -#include "tzdb/time_zone_private.h" - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path file = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - std::ofstream f{file}; - f << "# version " << version++ << '\n'; - f.write(input.data(), input.size()); -} - -static const std::chrono::tzdb& parse(std::string_view input) { - write(input); - return std::chrono::reload_tzdb(); -} - -static const std::vector<std::chrono::__tz::__continuation>& continuations(const std::chrono::time_zone& time_zone) { - return time_zone.__implementation().__continuations(); -} - -static void test_exception(std::string_view input, [[maybe_unused]] std::string_view what) { - write(input); - - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD std::chrono::reload_tzdb()); -} - -static void test_invalid() { - test_exception("Z", "corrupt tzdb: expected whitespace"); - - test_exception("Z ", "corrupt tzdb: expected a string"); - - test_exception("Z n", "corrupt tzdb: expected whitespace"); - - test_exception("Z n ", "corrupt tzdb: expected a digit"); - test_exception("Z n x", "corrupt tzdb: expected a digit"); - test_exception("Z n +", "corrupt tzdb: expected a digit"); - - test_exception("Z n 0", "corrupt tzdb: expected whitespace"); - - test_exception("Z n 0 ", "corrupt tzdb: expected a string"); - - test_exception("Z n 0 r", "corrupt tzdb: expected whitespace"); - - test_exception("Z n 0 r ", "corrupt tzdb: expected a string"); -} - -static void test_name() { - const std::chrono::tzdb& result = parse( - R"( -Z n 0 r f -)"); - assert(result.zones.size() == 1); - assert(result.zones[0].name() == "n"); -} - -static void test_stdoff() { - const std::chrono::tzdb& result = parse( - R"( -# Based on the examples in the man page. -# Note the input is not expected to have fractional seconds, they are truncated. -Zo na 2 r f -Zon nb 2:00 r f -Zone nc 01:28:14 r f -zONE nd 00:19:32.10 r f -zoNe ne 12:00 r f -Z nf 15:00 r f -Z ng 24:00 r f -Z nh 260:00 r f -Z ni -2:30 r f -Z nj - r f -)"); - - assert(result.zones.size() == 10); - for (std::size_t i = 0; i < result.zones.size(); ++i) - assert(continuations(result.zones[0]).size() == 1); - - assert(continuations(result.zones[0])[0].__stdoff == std::chrono::hours(2)); - assert(continuations(result.zones[1])[0].__stdoff == std::chrono::hours(2)); - assert(continuations(result.zones[2])[0].__stdoff == - std::chrono::hours(1) + std::chrono::minutes(28) + std::chrono::seconds(14)); - assert(continuations(result.zones[3])[0].__stdoff == std::chrono::minutes(19) + std::chrono::seconds(32)); - assert(continuations(result.zones[4])[0].__stdoff == std::chrono::hours(12)); - assert(continuations(result.zones[5])[0].__stdoff == std::chrono::hours(15)); - assert(continuations(result.zones[6])[0].__stdoff == std::chrono::hours(24)); - assert(continuations(result.zones[7])[0].__stdoff == std::chrono::hours(260)); - assert(continuations(result.zones[8])[0].__stdoff == -(std::chrono::hours(2) + std::chrono::minutes(30))); - assert(continuations(result.zones[9])[0].__stdoff == std::chrono::hours(0)); // The man page expresses it in hours -} - -static void test_rules() { - const std::chrono::tzdb& result = parse( - R"( -Z na 0 - f -Z nb 0 r f -Z nc 0 2d f -Z nd 0 2:00s f -Z ne 0 0 f -Z nf 0 0:00:01 f -Z ng 0 -0:00:01 f -)"); - - assert(result.zones.size() == 7); - for (std::size_t i = 0; i < result.zones.size(); ++i) - assert(continuations(result.zones[0]).size() == 1); - - assert(std::holds_alternative<std::monostate>(continuations(result.zones[0])[0].__rules)); - assert(std::get<std::string>(continuations(result.zones[1])[0].__rules) == "r"); - - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[2])[0].__rules).__time == - std::chrono::hours(2)); - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[2])[0].__rules).__is_dst == true); - - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[3])[0].__rules).__time == - std::chrono::hours(2)); - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[3])[0].__rules).__is_dst == false); - - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[4])[0].__rules).__time == - std::chrono::hours(0)); - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[4])[0].__rules).__is_dst == false); - - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[5])[0].__rules).__time == - std::chrono::seconds(1)); - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[5])[0].__rules).__is_dst == true); - - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[6])[0].__rules).__time == - -std::chrono::seconds(1)); - assert(std::get<std::chrono::__tz::__save>(continuations(result.zones[6])[0].__rules).__is_dst == true); -} - -static void test_format() { - const std::chrono::tzdb& result = parse( - R"( -Z n 0 r f -)"); - assert(result.zones.size() == 1); - assert(continuations(result.zones[0]).size() == 1); - assert(continuations(result.zones[0])[0].__format == "f"); -} - -static void test_until() { - const std::chrono::tzdb& result = parse( - R"( -Z na 0 r f -Z nb 0 r f 1000 -Z nc 0 r f -1000 N -Z nd 0 r f ma S 31 -Z ne 0 r f 0 jA LASTw -Z nf 0 r f -42 jUN m<=1 -Z ng 0 r f 42 jul Su>=12 -Z nh 0 r f 42 JUl 1 2w -Z ni 0 r f 42 July 1 01:28:14u -Z nj 0 r f 42 Jul 1 - -)"); - assert(result.zones.size() == 10); - for (std::size_t i = 0; i < result.zones.size(); ++i) - assert(continuations(result.zones[0]).size() == 1); - - std::chrono::__tz::__constrained_weekday r; - - assert(continuations(result.zones[0])[0].__year == std::chrono::year::min()); - assert(continuations(result.zones[0])[0].__in == std::chrono::January); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[1])[0].__year == std::chrono::year(1000)); - assert(continuations(result.zones[1])[0].__in == std::chrono::January); - assert(std::get<std::chrono::day>(continuations(result.zones[1])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[1])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[1])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[2])[0].__year == std::chrono::year(-1000)); - assert(continuations(result.zones[2])[0].__in == std::chrono::November); - assert(std::get<std::chrono::day>(continuations(result.zones[2])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[2])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[2])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[3])[0].__year == std::chrono::year::max()); - assert(continuations(result.zones[3])[0].__in == std::chrono::September); - assert(std::get<std::chrono::day>(continuations(result.zones[3])[0].__on) == std::chrono::day(31)); - assert(continuations(result.zones[3])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[3])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[4])[0].__year == std::chrono::year(0)); - assert(continuations(result.zones[4])[0].__in == std::chrono::January); - assert(std::get<std::chrono::weekday_last>(continuations(result.zones[4])[0].__on) == - std::chrono::weekday_last{std::chrono::Wednesday}); - assert(continuations(result.zones[4])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[4])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[5])[0].__year == std::chrono::year(-42)); - assert(continuations(result.zones[5])[0].__in == std::chrono::June); - r = std::get<std::chrono::__tz::__constrained_weekday>(continuations(result.zones[5])[0].__on); - assert(r.__weekday == std::chrono::Monday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__le); - assert(r.__day == std::chrono::day(1)); - assert(continuations(result.zones[5])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[5])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[6])[0].__year == std::chrono::year(42)); - assert(continuations(result.zones[6])[0].__in == std::chrono::July); - r = std::get<std::chrono::__tz::__constrained_weekday>(continuations(result.zones[6])[0].__on); - assert(r.__weekday == std::chrono::Sunday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__ge); - assert(r.__day == std::chrono::day(12)); - assert(continuations(result.zones[6])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[6])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[7])[0].__year == std::chrono::year(42)); - assert(continuations(result.zones[7])[0].__in == std::chrono::July); - assert(std::get<std::chrono::day>(continuations(result.zones[7])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[7])[0].__at.__time == std::chrono::hours(2)); - assert(continuations(result.zones[7])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[8])[0].__year == std::chrono::year(42)); - assert(continuations(result.zones[8])[0].__in == std::chrono::July); - assert(std::get<std::chrono::day>(continuations(result.zones[8])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[8])[0].__at.__time == - std::chrono::hours(1) + std::chrono::minutes(28) + std::chrono::seconds(14)); - assert(continuations(result.zones[8])[0].__at.__clock == std::chrono::__tz::__clock::__universal); - - assert(continuations(result.zones[9])[0].__year == std::chrono::year(42)); - assert(continuations(result.zones[9])[0].__in == std::chrono::July); - assert(std::get<std::chrono::day>(continuations(result.zones[9])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[9])[0].__at.__time == std::chrono::hours(0)); // The man page expresses it in hours - assert(continuations(result.zones[9])[0].__at.__clock == std::chrono::__tz::__clock::__local); -} - -static void test_continuation() { - const std::chrono::tzdb& result = parse( - R"( -Z na 0 r f -0 r f 1000 -0 r f -1000 N -0 r f ma S 31 -0 r f 0 Ja lastW -0 r f -42 Jun M<=1 -0 r f 42 Jul Su>=12 -0 r f 42 Jul 1 2w -0 r f 42 Jul 1 01:28:14u -0 r f 42 Jul 1 - -)"); - - assert(result.zones.size() == 1); - assert(continuations(result.zones[0]).size() == 10); - - std::chrono::__tz::__constrained_weekday r; - - assert(continuations(result.zones[0])[0].__year == std::chrono::year::min()); - assert(continuations(result.zones[0])[0].__in == std::chrono::January); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[0].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[0].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[0].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[1].__year == std::chrono::year(1000)); - assert(continuations(result.zones[0])[1].__in == std::chrono::January); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[1].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[1].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[1].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[2].__year == std::chrono::year(-1000)); - assert(continuations(result.zones[0])[2].__in == std::chrono::November); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[2].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[2].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[2].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[3].__year == std::chrono::year::max()); - assert(continuations(result.zones[0])[3].__in == std::chrono::September); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[3].__on) == std::chrono::day(31)); - assert(continuations(result.zones[0])[3].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[3].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[4].__year == std::chrono::year(0)); - assert(continuations(result.zones[0])[4].__in == std::chrono::January); - assert(std::get<std::chrono::weekday_last>(continuations(result.zones[0])[4].__on) == - std::chrono::weekday_last{std::chrono::Wednesday}); - assert(continuations(result.zones[0])[4].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[4].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[5].__year == std::chrono::year(-42)); - assert(continuations(result.zones[0])[5].__in == std::chrono::June); - r = std::get<std::chrono::__tz::__constrained_weekday>(continuations(result.zones[0])[5].__on); - assert(r.__weekday == std::chrono::Monday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__le); - assert(r.__day == std::chrono::day(1)); - assert(continuations(result.zones[0])[5].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[5].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[6].__year == std::chrono::year(42)); - assert(continuations(result.zones[0])[6].__in == std::chrono::July); - r = std::get<std::chrono::__tz::__constrained_weekday>(continuations(result.zones[0])[6].__on); - assert(r.__weekday == std::chrono::Sunday); - assert(r.__comparison == std::chrono::__tz::__constrained_weekday::__ge); - assert(r.__day == std::chrono::day(12)); - assert(continuations(result.zones[0])[6].__at.__time == std::chrono::seconds(0)); - assert(continuations(result.zones[0])[6].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[7].__year == std::chrono::year(42)); - assert(continuations(result.zones[0])[7].__in == std::chrono::July); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[7].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[7].__at.__time == std::chrono::hours(2)); - assert(continuations(result.zones[0])[7].__at.__clock == std::chrono::__tz::__clock::__local); - - assert(continuations(result.zones[0])[8].__year == std::chrono::year(42)); - assert(continuations(result.zones[0])[8].__in == std::chrono::July); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[8].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[8].__at.__time == - std::chrono::hours(1) + std::chrono::minutes(28) + std::chrono::seconds(14)); - assert(continuations(result.zones[0])[8].__at.__clock == std::chrono::__tz::__clock::__universal); - - assert(continuations(result.zones[0])[9].__year == std::chrono::year(42)); - assert(continuations(result.zones[0])[9].__in == std::chrono::July); - assert(std::get<std::chrono::day>(continuations(result.zones[0])[9].__on) == std::chrono::day(1)); - assert(continuations(result.zones[0])[9].__at.__time == std::chrono::hours(0)); // The man page expresses it in hours - assert(continuations(result.zones[0])[9].__at.__clock == std::chrono::__tz::__clock::__local); -} - -int main(int, const char**) { - test_invalid(); - test_name(); - test_stdoff(); - test_rules(); - test_format(); - test_until(); - - test_continuation(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp deleted file mode 100644 index 73e6bf2..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// XFAIL: libcpp-has-no-experimental-tzdb - -// <chrono> - -// class ambiguous_local_time -// -// template<class Duration> -// ambiguous_local_time(const local_time<Duration>& tp, const local_info& i); - -#include <chrono> - -#include "check_assertion.h" - -// [time.zone.exception.ambig]/2 -// Preconditions: i.result == local_info::ambiguous is true. -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE( - (std::chrono::ambiguous_local_time{ - std::chrono::local_seconds{}, - std::chrono::local_info{-1, // this is not one of the "named" result values - std::chrono::sys_info{}, - std::chrono::sys_info{}}}), - "creating an ambiguous_local_time from a local_info that is not ambiguous"); - - TEST_LIBCPP_ASSERT_FAILURE( - (std::chrono::ambiguous_local_time{ - std::chrono::local_seconds{}, - std::chrono::local_info{std::chrono::local_info::unique, std::chrono::sys_info{}, std::chrono::sys_info{}}}), - "creating an ambiguous_local_time from a local_info that is not ambiguous"); - - TEST_LIBCPP_ASSERT_FAILURE( - (std::chrono::ambiguous_local_time{ - std::chrono::local_seconds{}, - std::chrono::local_info{ - std::chrono::local_info::nonexistent, std::chrono::sys_info{}, std::chrono::sys_info{}}}), - "creating an ambiguous_local_time from a local_info that is not ambiguous"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp deleted file mode 100644 index fdd9f79..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// XFAIL: libcpp-has-no-experimental-tzdb - -// <chrono> - -// class nonexistent_local_time -// -// template<class Duration> -// nonexistent_local_time(const local_time<Duration>& tp, const local_info& i); - -#include <chrono> - -#include "check_assertion.h" - -// [time.zone.exception.nonexist]/2 -// Preconditions: i.result == local_info::nonexistent is true. -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE( - (std::chrono::nonexistent_local_time{ - std::chrono::local_seconds{}, - std::chrono::local_info{-1, // this is not one of the "named" result values - std::chrono::sys_info{}, - std::chrono::sys_info{}}}), - "creating an nonexistent_local_time from a local_info that is not non-existent"); - - TEST_LIBCPP_ASSERT_FAILURE( - (std::chrono::nonexistent_local_time{ - std::chrono::local_seconds{}, - std::chrono::local_info{std::chrono::local_info::unique, std::chrono::sys_info{}, std::chrono::sys_info{}}}), - "creating an nonexistent_local_time from a local_info that is not non-existent"); - - TEST_LIBCPP_ASSERT_FAILURE( - (std::chrono::nonexistent_local_time{ - std::chrono::local_seconds{}, - std::chrono::local_info{ - std::chrono::local_info::ambiguous, std::chrono::sys_info{}, std::chrono::sys_info{}}}), - "creating an nonexistent_local_time from a local_info that is not non-existent"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.info/time.zone.info.local/ostream.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.info/time.zone.info.local/ostream.pass.cpp deleted file mode 100644 index b3fbaaf..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.info/time.zone.info.local/ostream.pass.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-localization - -// TODO FMT This test should not require std::to_chars(floating-point) -// XFAIL: availability-fp_to_chars-missing - -// XFAIL: libcpp-has-no-experimental-tzdb - -// <chrono> - -// template<class charT, class traits> -// basic_ostream<charT, traits>& -// operator<<(basic_ostream<charT, traits>& os, const local_info& r); - -// [time.zone.info.local] -// 7 Effects: Streams out the local_info object r in an unspecified format. -// 8 Returns: os. -// -// Tests the output produced by this function. - -#include <cassert> -#include <chrono> -#include <memory> -#include <sstream> - -#include "assert_macros.h" -#include "test_macros.h" -#include "make_string.h" -#include "concat_macros.h" - -#define SV(S) MAKE_STRING_VIEW(CharT, S) - -template <class CharT> -static void test(std::basic_string_view<CharT> expected, std::chrono::local_info&& info) { - std::basic_stringstream<CharT> sstr; - sstr << info; - std::basic_string<CharT> output = sstr.str(); - - TEST_REQUIRE(expected == output, - TEST_WRITE_CONCATENATED("\nExpected output ", expected, "\nActual output ", output, '\n')); -} - -template <class CharT> -static void test() { - using namespace std::literals::chrono_literals; - namespace tz = std::chrono; - // result values matching the "known" results - test(SV("unique: " - "{[-10484-10-16 15:30:08, 14423-03-17 15:30:07) 00:00:00 0min \"TZ\", " - "[1970-01-01 00:00:00, 1970-01-01 00:00:00) 00:00:00 0min \"\"}"), - tz::local_info{tz::local_info::unique, - tz::sys_info{tz::sys_seconds::min(), tz::sys_seconds::max(), 0s, 0min, "TZ"}, - tz::sys_info{}}); - - test(SV("non-existent: " - "{[1970-01-01 00:00:00, 2038-12-31 00:00:00) 12:23:45 -67min \"NEG\", " - "[1970-01-01 00:00:00, 2038-12-31 00:00:00) -12:23:45 67min \"POS\"}"), - tz::local_info{ - tz::local_info::nonexistent, - tz::sys_info{static_cast<tz::sys_days>(tz::year_month_day{1970y, tz::January, 1d}), - static_cast<tz::sys_days>(tz::year_month_day{2038y, tz::December, 31d}), - 12h + 23min + 45s, - -67min, - "NEG"}, - tz::sys_info{static_cast<tz::sys_days>(tz::year_month_day{1970y, tz::January, 1d}), - static_cast<tz::sys_days>(tz::year_month_day{2038y, tz::December, 31d}), - -(12h + 23min + 45s), - 67min, - "POS"}}); - - test(SV("ambiguous: " - "{[1970-01-01 00:00:00, 2038-12-31 00:00:00) 12:23:45 -67min \"NEG\", " - "[1970-01-01 00:00:00, 2038-12-31 00:00:00) -12:23:45 67min \"POS\"}"), - tz::local_info{ - tz::local_info::ambiguous, - tz::sys_info{static_cast<tz::sys_days>(tz::year_month_day{1970y, tz::January, 1d}), - static_cast<tz::sys_days>(tz::year_month_day{2038y, tz::December, 31d}), - 12h + 23min + 45s, - -67min, - "NEG"}, - tz::sys_info{static_cast<tz::sys_days>(tz::year_month_day{1970y, tz::January, 1d}), - static_cast<tz::sys_days>(tz::year_month_day{2038y, tz::December, 31d}), - -(12h + 23min + 45s), - 67min, - "POS"}}); - - // result values not matching the "known" results - test( - SV("unspecified result (-1): " - "{[-10484-10-16 15:30:08, 14423-03-17 15:30:07) 00:00:00 0min \"TZ\", " - "[1970-01-01 00:00:00, 1970-01-01 00:00:00) 00:00:00 0min \"\"}"), - tz::local_info{-1, tz::sys_info{tz::sys_seconds::min(), tz::sys_seconds::max(), 0s, 0min, "TZ"}, tz::sys_info{}}); - test(SV("unspecified result (3): " - "{[-10484-10-16 15:30:08, 14423-03-17 15:30:07) 00:00:00 0min \"TZ\", " - "[1970-01-01 00:00:00, 1970-01-01 00:00:00) 00:00:00 0min \"\"}"), - tz::local_info{3, tz::sys_info{tz::sys_seconds::min(), tz::sys_seconds::max(), 0s, 0min, "TZ"}, tz::sys_info{}}); -} - -int main(int, const char**) { - test<char>(); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - test<wchar_t>(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp deleted file mode 100644 index 6b41c7b..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.info/time.zone.info.sys/ostream.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-localization - -// TODO FMT This test should not require std::to_chars(floating-point) -// XFAIL: availability-fp_to_chars-missing - -// XFAIL: libcpp-has-no-experimental-tzdb - -// <chrono> - -// template<class charT, class traits> -// basic_ostream<charT, traits>& -// operator<<(basic_ostream<charT, traits>& os, const sys_info& r); - -// [time.zone.info.sys] -// 7 Effects: Streams out the sys_info object r in an unspecified format. -// 8 Returns: os. -// -// Tests the output produced by this function. - -#include <cassert> -#include <chrono> -#include <memory> -#include <sstream> - -#include "assert_macros.h" -#include "test_macros.h" -#include "make_string.h" -#include "concat_macros.h" - -#define SV(S) MAKE_STRING_VIEW(CharT, S) - -template <class CharT> -static void test(std::basic_string_view<CharT> expected, std::chrono::sys_info&& info) { - std::basic_stringstream<CharT> sstr; - sstr << info; - std::basic_string<CharT> output = sstr.str(); - - TEST_REQUIRE(expected == output, - TEST_WRITE_CONCATENATED("\nExpected output ", expected, "\nActual output ", output, '\n')); -} - -template <class CharT> -static void test() { - using namespace std::literals::chrono_literals; - namespace tz = std::chrono; - - test(SV("[-10484-10-16 15:30:08, 14423-03-17 15:30:07) 00:00:00 0min \"TZ\""), - tz::sys_info{tz::sys_seconds::min(), tz::sys_seconds::max(), 0s, 0min, "TZ"}); - - test(SV("[1970-01-01 00:00:00, 2038-12-31 00:00:00) 12:23:45 -67min \"DMY\""), - tz::sys_info{static_cast<tz::sys_days>(tz::year_month_day{1970y, tz::January, 1d}), - static_cast<tz::sys_days>(tz::year_month_day{2038y, tz::December, 31d}), - 12h + 23min + 45s, - -67min, - "DMY"}); -} - -int main(int, const char**) { - test<char>(); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - test<wchar_t>(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/choose.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/choose.pass.cpp deleted file mode 100644 index 23ef9c8..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/choose.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// enum class choose; - -#include <chrono> -#include <type_traits> -#include <cassert> - -#include "test_macros.h" - -int main(int, char**) { - using E = std::chrono::choose; - static_assert(std::is_enum_v<E>); - - // Check that E is a scoped enum by checking for conversions. - using UT = std::underlying_type_t<E>; - static_assert(!std::is_convertible_v<E, UT>); - - [[maybe_unused]] const E& early = E::earliest; - [[maybe_unused]] const E& late = E::latest; - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp deleted file mode 100644 index d9ca1c8..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// template <class _Duration> -// local_time<common_type_t<Duration, seconds>> -// to_local(const sys_time<Duration>& tp) const; - -#include <chrono> - -#include "check_assertion.h" - -// Tests values that cannot be converted. To make sure the test is does not depend on changes -// in the database it uses a time zone with a fixed offset. -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE(std::chrono::locate_zone("Etc/GMT+1")->to_local(std::chrono::sys_seconds::min()), - "cannot convert the system time; it would be before the minimum local clock value"); - - // TODO TZDB look why std::chrono::sys_seconds::max() fails - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::locate_zone("Etc/GMT-1")->to_local(std::chrono::sys_seconds::max() - std::chrono::seconds(1)), - "cannot convert the system time; it would be after the maximum local clock value"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.pass.cpp deleted file mode 100644 index 3a2ff00..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// XFAIL: libcpp-has-no-experimental-tzdb - -// <chrono> - -// template <class _Duration> -// sys_time<common_type_t<Duration, seconds>> -// to_sys(const local_time<Duration>& tp) const; - -#include <chrono> - -#include "check_assertion.h" - -// Tests values that cannot be converted. To make sure the test is does not depend on changes -// in the database it uses a time zone with a fixed offset. -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE(std::chrono::locate_zone("Etc/GMT-1")->to_sys(std::chrono::local_seconds::min()), - "cannot convert the local time; it would be before the minimum system clock value"); - - // TODO TZDB look why std::chrono::local_seconds::max() fails - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::locate_zone("Etc/GMT+1")->to_sys(std::chrono::local_seconds::max() - std::chrono::seconds(1)), - "cannot convert the local time; it would be after the maximum system clock value"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp deleted file mode 100644 index 6542934..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// REQUIRES: has-unix-headers -// REQUIRES: libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// XFAIL: libcpp-has-no-experimental-tzdb - -// <chrono> - -// template <class _Duration> -// sys_time<common_type_t<Duration, seconds>> -// to_sys(const local_time<Duration>& tp, choose z) const; - -#include <chrono> - -#include "check_assertion.h" - -// Tests values that cannot be converted. To make sure the test is does not depend on changes -// in the database it uses a time zone with a fixed offset. -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::locate_zone("Etc/GMT-1")->to_sys(std::chrono::local_seconds::min(), std::chrono::choose::earliest), - "cannot convert the local time; it would be before the minimum system clock value"); - - // TODO TZDB look why std::chrono::local_seconds::max() fails - TEST_LIBCPP_ASSERT_FAILURE( - std::chrono::locate_zone("Etc/GMT+1") - ->to_sys(std::chrono::local_seconds::max() - std::chrono::seconds(1), std::chrono::choose::latest), - "cannot convert the local time; it would be after the maximum system clock value"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp deleted file mode 100644 index afd1273..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp +++ /dev/null @@ -1,204 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// class time_zone; - -// template <class _Duration> -// sys_info get_info(const sys_time<_Duration>& time) const; - -// tests the parts not validated in the public test -// - Validates a zone with an UNTIL in its last continuation is corrupt -// - The formatting of the FORMAT field's constrains -// - Formatting of "%z", this is valid but not present in the actual database - -#include <algorithm> -#include <cassert> -#include <fstream> -#include <chrono> -#include <format> - -#include "test_macros.h" -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -/***** ***** HELPERS ***** *****/ - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path file = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - std::ofstream f{file}; - f << "# version " << version++ << '\n'; - f.write(input.data(), input.size()); -} - -static const std::chrono::tzdb& parse(std::string_view input) { - write(input); - return std::chrono::reload_tzdb(); -} - -[[nodiscard]] static std::chrono::sys_seconds to_sys_seconds(int year) { - std::chrono::year_month_day result{std::chrono::year{year}, std::chrono::January, std::chrono::day{1}}; - - return std::chrono::time_point_cast<std::chrono::seconds>(static_cast<std::chrono::sys_days>(result)); -} - -static void test_exception([[maybe_unused]] std::string_view input, [[maybe_unused]] std::string_view what) { -#ifndef TEST_HAS_NO_EXCEPTIONS - const std::chrono::tzdb& tzdb = parse(input); - const std::chrono::time_zone* tz = tzdb.locate_zone("Format"); - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD tz->get_info(to_sys_seconds(2000))); -#endif // TEST_HAS_NO_EXCEPTIONS -} - -static void zone_without_until_entry() { -#ifndef TEST_HAS_NO_EXCEPTIONS - const std::chrono::tzdb& tzdb = parse( - R"( -Z America/Paramaribo -3:40:40 - LMT 1911 --3:40:52 - PMT 1935 --3:40:36 - PMT 1945 O --3:30 - -0330 1984 O -# -3 - -03 Commented out so the last entry has an UNTIL field. -)"); - const std::chrono::time_zone* tz = tzdb.locate_zone("America/Paramaribo"); - - TEST_IGNORE_NODISCARD tz->get_info(to_sys_seconds(1984)); - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - std::string what = "tzdb: corrupt db"; - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD tz->get_info(to_sys_seconds(1985))); -#endif // TEST_HAS_NO_EXCEPTIONS -} - -static void invalid_format() { - test_exception( - R"( -R F 2000 max - Jan 5 0 0 foo -Z Format 0 F %zandfoo)", - "corrupt tzdb FORMAT field: %z should be the entire contents, instead contains '%zandfoo'"); - - test_exception( - R"( -R F 2000 max - Jan 5 0 0 foo -Z Format 0 F %q)", - "corrupt tzdb FORMAT field: invalid sequence '%q' found, expected %s or %z"); - - test_exception( - R"( -R F 2000 max - Jan 5 0 0 foo -Z Format 0 F !)", - "corrupt tzdb FORMAT field: invalid character '!' found, expected +, -, or an alphanumeric value"); - - test_exception( - R"( -R F 2000 max - Jan 5 0 0 foo -Z Format 0 F @)", - "corrupt tzdb FORMAT field: invalid character '@' found, expected +, -, or an alphanumeric value"); - - test_exception( - R"( -R F 2000 max - Jan 5 0 0 foo -Z Format 0 F $)", - "corrupt tzdb FORMAT field: invalid character '$' found, expected +, -, or an alphanumeric value"); - - test_exception( - R"( -R F 1970 max - Jan 5 0 0 foo -Z Format 0 F %)", - "corrupt tzdb FORMAT field: input ended with the start of the escape sequence '%'"); - - test_exception( - R"( -R F 2000 max - Jan 5 0 0 - -Z Format 0 F %s)", - "corrupt tzdb FORMAT field: result is empty"); -} - -static void test_abbrev(std::string_view input, std::string_view expected) { - const std::chrono::tzdb& tzdb = parse(input); - const std::chrono::time_zone* tz = tzdb.locate_zone("Format"); - std::string result = tz->get_info(to_sys_seconds(2000)).abbrev; - TEST_LIBCPP_REQUIRE(result == expected, TEST_WRITE_CONCATENATED("\nExpected ", expected, "\nActual ", result, '\n')); -} - -static void percentage_z_format() { - test_abbrev( - R"( -R F 1999 max - Jan 5 0 0 foo -Z Format 0 F %z)", - "+00"); - - test_abbrev( - R"( -R F 1999 max - Jan 5 0 1 foo -Z Format 0 F %z)", - "+01"); - - test_abbrev( - R"( -R F 1999 max - Jan 5 0 -1 foo -Z Format 0 F %z)", - "-01"); - - test_abbrev( - R"( -R F 1999 max - Jan 5 0 0 foo -Z Format 0:45 F %z)", - "+0045"); - - test_abbrev( - R"( -R F 1999 max - Jan 5 0 -1 foo -Z Format 0:45 F %z)", - "-0015"); - - test_abbrev( - R"( -Z Format -1:2:20 - LMT 1912 Ja 1 1u --1 - %z)", - "-01"); -} - -int main(int, const char**) { - zone_without_until_entry(); - invalid_format(); - percentage_z_format(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.rule_selection.pass.cpp b/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.rule_selection.pass.cpp deleted file mode 100644 index 33c5d049..0000000 --- a/libcxx/test/libcxx-03/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.rule_selection.pass.cpp +++ /dev/null @@ -1,185 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem, no-localization, no-tzdb - -// XFAIL: libcpp-has-no-experimental-tzdb -// XFAIL: availability-tzdb-missing - -// <chrono> - -// class time_zone; - -// template <class _Duration> -// sys_info get_info(const sys_time<_Duration>& time) const; - -// The time zone database contains of the following entries -// - Zones, -// - Rules, -// - Links, and -// - Leapseconds. -// -// The public tzdb struct stores all entries except the Rules. How -// implementations keep track of the Rules is not specified. When the sys_info -// for a time_zone is requested it needs to use the correct Rules. This lookup -// cannot rely on 'get_tzdb()` since that returns the most recently loaded -// database. -// -// A reload could change the rules of a time zone or the time zone could no -// longer be present in the current database. These two conditions are tested. -// -// It is possible the tzdb entry has been removed by the user from the tzdb_list -// after a reload. This is UB and not tested. - -#include <cassert> -#include <fstream> -#include <chrono> - -#include "test_macros.h" -#include "assert_macros.h" -#include "concat_macros.h" -#include "filesystem_test_helper.h" -#include "test_tzdb.h" - -/***** ***** HELPERS ***** *****/ - -scoped_test_env env; -[[maybe_unused]] const std::filesystem::path dir = env.create_dir("zoneinfo"); -const std::filesystem::path file = env.create_file("zoneinfo/tzdata.zi"); - -std::string_view std::chrono::__libcpp_tzdb_directory() { - static std::string result = dir.string(); - return result; -} - -static void write(std::string_view input) { - static int version = 0; - - std::ofstream f{file}; - f << "# version " << version++ << '\n'; - f.write(input.data(), input.size()); -} - -static const std::chrono::tzdb& parse(std::string_view input) { - write(input); - return std::chrono::reload_tzdb(); -} - -[[nodiscard]] static std::chrono::sys_seconds to_sys_seconds( - std::chrono::year year, - std::chrono::month month, - std::chrono::day day, - std::chrono::hours h = std::chrono::hours(0), - std::chrono::minutes m = std::chrono::minutes{0}, - std::chrono::seconds s = std::chrono::seconds{0}) { - std::chrono::year_month_day result{year, month, day}; - - return std::chrono::time_point_cast<std::chrono::seconds>(static_cast<std::chrono::sys_days>(result)) + h + m + s; -} - -static void assert_equal(const std::chrono::sys_info& lhs, const std::chrono::sys_info& rhs) { - TEST_REQUIRE(lhs.begin == rhs.begin, - TEST_WRITE_CONCATENATED("\nBegin:\nExpected output ", lhs.begin, "\nActual output ", rhs.begin, '\n')); - TEST_REQUIRE(lhs.end == rhs.end, - TEST_WRITE_CONCATENATED("\nEnd:\nExpected output ", lhs.end, "\nActual output ", rhs.end, '\n')); - TEST_REQUIRE( - lhs.offset == rhs.offset, - TEST_WRITE_CONCATENATED("\nOffset:\nExpected output ", lhs.offset, "\nActual output ", rhs.offset, '\n')); - TEST_REQUIRE(lhs.save == rhs.save, - TEST_WRITE_CONCATENATED("\nSave:\nExpected output ", lhs.save, "\nActual output ", rhs.save, '\n')); - TEST_REQUIRE( - lhs.abbrev == rhs.abbrev, - TEST_WRITE_CONCATENATED("\nAbbrev:\nExpected output ", lhs.abbrev, "\nActual output ", rhs.abbrev, '\n')); -} - -/***** ***** TESTS ***** *****/ - -int main(int, const char**) { - using namespace std::literals::chrono_literals; - - // DST starts on the first of March. - const std::chrono::tzdb& tzdb_1 = parse( - R"( -Z Test 0 - LMT 1900 -0 Rule %s - -R Rule 1900 max - Mar 1 2u 1 Summer -R Rule 1900 max - Oct 1 2u 0 Winter -)"); - - const std::chrono::time_zone* tz_1 = tzdb_1.locate_zone("Test"); - assert_equal( - std::chrono::sys_info( - to_sys_seconds(1901y, std::chrono::March, 1d, 2h), - to_sys_seconds(1901y, std::chrono::October, 1d, 2h), - 1h, - 60min, - "Summer"), - tz_1->get_info(to_sys_seconds(1901y, std::chrono::March, 1d, 2h))); - - // The DST start changes from the first of March to the first of April. - const std::chrono::tzdb& tzdb_2 = parse( - R"( -Z Test 0 - LMT 1900 -0 Rule %s - -R Rule 1900 max - Apr 1 2u 1 Summer -R Rule 1900 max - Oct 1 2u 0 Winter -)"); - - const std::chrono::time_zone* tz_2 = tzdb_2.locate_zone("Test"); - assert_equal( - std::chrono::sys_info( - to_sys_seconds(1900y, std::chrono::October, 1d, 2h), - to_sys_seconds(1901y, std::chrono::April, 1d, 2h), - 0s, - 0min, - "Winter"), - tz_2->get_info(to_sys_seconds(1901y, std::chrono::March, 1d, 2h))); - - // Validate when using tz_1 the DST still starts on the first of March. - assert_equal( - std::chrono::sys_info( - to_sys_seconds(1901y, std::chrono::March, 1d, 2h), - to_sys_seconds(1901y, std::chrono::October, 1d, 2h), - 1h, - 60min, - "Summer"), - tz_1->get_info(to_sys_seconds(1901y, std::chrono::March, 1d, 2h))); - - // The zone Test is no longer present - [[maybe_unused]] const std::chrono::tzdb& tzdb_3 = parse("Z Etc/UTC 0 - UTC"); -#ifndef TEST_HAS_NO_EXCEPTIONS - TEST_VALIDATE_EXCEPTION( - std::runtime_error, - [&]([[maybe_unused]] const std::runtime_error& e) { - std::string what = "tzdb: requested time zone not found"; - TEST_LIBCPP_REQUIRE( - e.what() == what, - TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); - }, - TEST_IGNORE_NODISCARD tzdb_3.locate_zone("Test")); -#endif // TEST_HAS_NO_EXCEPTIONS - - // Search the zone Test in the original version 1 of the TZDB. - // This database should be unaffected by the removal in version 3. - tz_1 = tzdb_1.locate_zone("Test"); - - // Validate the rules still uses version 1's DST switch in March. - assert_equal( - std::chrono::sys_info( - to_sys_seconds(1901y, std::chrono::March, 1d, 2h), - to_sys_seconds(1901y, std::chrono::October, 1d, 2h), - 1h, - 60min, - "Summer"), - tz_1->get_info(to_sys_seconds(1901y, std::chrono::March, 1d, 2h))); - - return 0; -} diff --git a/libcxx/test/libcxx-03/type_traits/is_always_bitcastable.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_always_bitcastable.compile.pass.cpp deleted file mode 100644 index 9bbb85f..0000000 --- a/libcxx/test/libcxx-03/type_traits/is_always_bitcastable.compile.pass.cpp +++ /dev/null @@ -1,219 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// <type_traits> -// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// -// __is_always_bitcastable<_From, _To> - -#include "test_macros.h" -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") -#include <__type_traits/is_always_bitcastable.h> - -#include <climits> -#include <cstdint> -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -#include <cwchar> -#endif -#include "type_algorithms.h" - -// To test pointers to functions. -void Func1() {} -using FuncPtr1 = decltype(&Func1); -int Func2() { return 0; } -using FuncPtr2 = decltype(&Func2); - -template <bool Expected, class T, class U> -constexpr void check_one() { - static_assert(std::__is_always_bitcastable<T, U>::value == Expected); -} - -template <bool Expected, class T, class U> -constexpr void check_with_volatile() { - check_one<Expected, T, U>(); - check_one<Expected, volatile T, U>(); - check_one<Expected, T, volatile U>(); - check_one<Expected, volatile T, volatile U>(); -} - -template <bool Expected, class T, class U> -constexpr void check_with_cv() { - check_with_volatile<Expected, T, U>(); - check_with_volatile<Expected, const T, U>(); - check_with_volatile<Expected, T, const U>(); - check_with_volatile<Expected, const T, const U>(); -} - -template <bool Expected, class Types1, class Types2 = Types1> -constexpr void check() { - types::for_each(Types1{}, []<class T>() { - types::for_each(Types2{}, []<class U>() { - check_with_cv<Expected, T, U>(); - }); - }); -} - -template <bool Expected, class Types1, class Types2> -constexpr void check_both_ways() { - check<Expected, Types1, Types2>(); - check<Expected, Types2, Types1>(); -} - -constexpr void test() { - // Arithmetic types. - { - // Bit-castable arithmetic types. - - // 8-bit types. - using integral_8 = types::type_list<char8_t, std::int8_t, std::uint8_t>; - using chars = types::type_list<char, unsigned char, signed char>; -#if CHAR_BIT == 8 - check<true, types::concatenate_t<integral_8, chars>>(); -#else - check<true, integral_8>(); - check<true, chars>(); -#endif - - // 16-bit types. - using integral_16 = types::type_list<char16_t, std::int16_t, std::uint16_t>; -#if !defined(TEST_HAS_NO_WIDE_CHARACTERS) && __WCHAR_WIDTH__ == 16 - check<true, types::concatenate_t<integral_16, types::type_list<wchar_t>>>(); -#else - check<true, integral_16>(); -#endif - - // 32-bit types. - using integral_32 = types::type_list<char32_t, std::int32_t, std::uint32_t>; -#if !defined(TEST_HAS_NO_WIDE_CHARACTERS) && __WCHAR_WIDTH__ == 32 - check<true, types::concatenate_t<integral_32, types::type_list<wchar_t>>>(); -#else - check<true, integral_32>(); -#endif - - // 64-bit types. - using integral_64 = types::type_list<std::int64_t, std::uint64_t>; - check<true, integral_64>(); - - // 128-bit types. -#ifndef TEST_HAS_NO_INT128 - check<true, types::type_list<__int128_t, __uint128_t>>(); -#endif - - // Bool. - check<true, types::type_list<bool>, types::concatenate_t<types::type_list<bool>, integral_8>>(); - - // Non-bit-castable arithmetic types. - - // Floating-point. - check_both_ways<false, types::floating_point_types, types::integral_types>(); - check_both_ways<false, types::type_list<float>, types::type_list<double, long double>>(); - check_both_ways<false, types::type_list<double>, types::type_list<float, long double>>(); - check_both_ways<false, types::type_list<long double>, types::type_list<float, double>>(); - - // Different sizes. - check_both_ways<false, integral_8, types::concatenate_t<integral_16, integral_32, integral_64>>(); - check_both_ways<false, integral_16, types::concatenate_t<integral_8, integral_32, integral_64>>(); - check_both_ways<false, integral_32, types::concatenate_t<integral_8, integral_16, integral_64>>(); - check_both_ways<false, integral_64, types::concatenate_t<integral_8, integral_16, integral_32>>(); - - // Different representations -- can convert from bool to other integral types, but not vice versa. - check<true, types::type_list<bool>, integral_8>(); - using larger_than_bool = types::concatenate_t< - integral_16, - integral_32, - integral_64, - types::floating_point_types>; - check<false, types::type_list<bool>, larger_than_bool>(); - check<false, types::concatenate_t<integral_8, larger_than_bool>, types::type_list<bool>>(); - - // Different representations -- floating point vs. integral. - check_both_ways<false, types::floating_point_types, types::integral_types>(); - } - - // Enumerations. - { - enum E1 { Value1 }; - enum E2 { Value2 }; - check<true, types::type_list<E1>>(); - check_both_ways<false, types::type_list<E1>, types::type_list<E2>>(); - - enum class ScopedE1 { Value1 }; - enum class ScopedE2 { Value1 }; - check<true, types::type_list<ScopedE1>>(); - check_both_ways<false, types::type_list<ScopedE1>, types::type_list<ScopedE2>>(); - } - - // Pointers. - { - check<true, types::type_list<int*>>(); - check_both_ways<false, types::type_list<int*>, types::type_list<const int*, long*, void*>>(); - - check<true, types::type_list<FuncPtr1>>(); - check_both_ways<false, types::type_list<FuncPtr1>, types::type_list<FuncPtr2>>(); - } - - // Pointers to members. - { - struct S { - int mem_obj1 = 0; - long mem_obj2 = 0; - void MemFunc1() {} - int MemFunc2() { return 0; } - }; - using MemObjPtr1 = decltype(&S::mem_obj1); - using MemObjPtr2 = decltype(&S::mem_obj2); - using MemFuncPtr1 = decltype(&S::MemFunc1); - using MemFuncPtr2 = decltype(&S::MemFunc2); - - check<true, types::type_list<MemObjPtr1>>(); - check<true, types::type_list<MemFuncPtr1>>(); - check_both_ways<false, types::type_list<MemObjPtr1>, types::type_list<MemObjPtr2>>(); - check_both_ways<false, types::type_list<MemFuncPtr1>, types::type_list<MemFuncPtr2>>(); - } - - // Trivial classes. - { - struct S1 {}; - check<true, types::type_list<S1>>(); - - struct S2 {}; - check_both_ways<false, types::type_list<S1>, types::type_list<S2>>(); - - // Having a `volatile` member doesn't prevent a class type from being considered trivially copyable. This is - // unfortunate behavior but it is consistent with the Standard. - struct VolatileMembersS { - volatile int x; - }; - check<true, types::type_list<VolatileMembersS>>(); - } - - // Trivial unions. - { - union U1 {}; - check<true, types::type_list<U1>>(); - - union U2 {}; - check_both_ways<false, types::type_list<U1>, types::type_list<U2>>(); - - union VolatileMembersU { - volatile int x; - }; - check<true, types::type_list<VolatileMembersU>>(); - } - - // References are not objects, and thus are not bit-castable. - { - check_both_ways<false, types::type_list<int&>, types::type_list<int&>>(); - } - - // Arrays. - { - check<true, types::type_list<int[8]>>(); - } -} diff --git a/libcxx/test/libcxx-03/type_traits/is_implicitly_default_constructible.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_implicitly_default_constructible.pass.cpp deleted file mode 100644 index ff0ab6f..0000000 --- a/libcxx/test/libcxx-03/type_traits/is_implicitly_default_constructible.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <type_traits> - -// __is_implicitly_default_constructible<Tp> - -#include <__type_traits/is_implicitly_default_constructible.h> - -struct ExplicitlyDefaultConstructible1 { - explicit ExplicitlyDefaultConstructible1() = default; -}; - -struct ExplicitlyDefaultConstructible2 { - explicit ExplicitlyDefaultConstructible2() { } -}; - -struct ImplicitlyDefaultConstructible1 { - ImplicitlyDefaultConstructible1() { } -}; - -struct ImplicitlyDefaultConstructible2 { - ImplicitlyDefaultConstructible2() = default; -}; - -struct NonDefaultConstructible1 { - NonDefaultConstructible1() = delete; -}; - -struct NonDefaultConstructible2 { - explicit NonDefaultConstructible2() = delete; -}; - -struct NonDefaultConstructible3 { - NonDefaultConstructible3(NonDefaultConstructible3&&) { } -}; - -struct ProtectedDefaultConstructible { -protected: - ProtectedDefaultConstructible() = default; -}; - -struct PrivateDefaultConstructible { -private: - PrivateDefaultConstructible() = default; -}; - -struct Base { }; - -struct ProtectedDefaultConstructibleWithBase : Base { -protected: - ProtectedDefaultConstructibleWithBase() = default; -}; - -struct PrivateDefaultConstructibleWithBase : Base { -private: - PrivateDefaultConstructibleWithBase() = default; -}; - -static_assert(!std::__is_implicitly_default_constructible<ExplicitlyDefaultConstructible1>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<ExplicitlyDefaultConstructible2>::value, ""); -static_assert(std::__is_implicitly_default_constructible<ImplicitlyDefaultConstructible1>::value, ""); -static_assert(std::__is_implicitly_default_constructible<ImplicitlyDefaultConstructible2>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<NonDefaultConstructible1>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<NonDefaultConstructible2>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<NonDefaultConstructible3>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<ProtectedDefaultConstructible>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<PrivateDefaultConstructible>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<ProtectedDefaultConstructibleWithBase>::value, ""); -static_assert(!std::__is_implicitly_default_constructible<PrivateDefaultConstructibleWithBase>::value, ""); - -int main(int, char**) { - return 0; -} diff --git a/libcxx/test/libcxx-03/type_traits/is_pointer.arc.pass.mm b/libcxx/test/libcxx-03/type_traits/is_pointer.arc.pass.mm deleted file mode 100644 index 8651411..0000000 --- a/libcxx/test/libcxx-03/type_traits/is_pointer.arc.pass.mm +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// REQUIRES: has-fobjc-arc -// ADDITIONAL_COMPILE_FLAGS: -fobjc-arc - -// <type_traits> - -// std::is_pointer - -// Test that we correctly handle Objective-C++ ARC qualifiers on pointers. - -#include <type_traits> -#include "test_macros.h" - - -template <typename T> -void assert_is_pointer() { - static_assert(std::is_pointer<T>::value, ""); -#if TEST_STD_VER > 14 - static_assert(std::is_pointer_v<T>, ""); -#endif -} - -template <typename T> -void test_is_pointer() { - assert_is_pointer<T>(); - - assert_is_pointer<T __weak>(); - assert_is_pointer<T __strong>(); - assert_is_pointer<T __autoreleasing>(); - assert_is_pointer<T __unsafe_unretained>(); - - assert_is_pointer<T __weak const>(); - assert_is_pointer<T __strong const>(); - assert_is_pointer<T __autoreleasing const>(); - assert_is_pointer<T __unsafe_unretained const>(); - - assert_is_pointer<T __weak volatile>(); - assert_is_pointer<T __strong volatile>(); - assert_is_pointer<T __autoreleasing volatile>(); - assert_is_pointer<T __unsafe_unretained volatile>(); - - assert_is_pointer<T __weak const volatile>(); - assert_is_pointer<T __strong const volatile>(); - assert_is_pointer<T __autoreleasing const volatile>(); - assert_is_pointer<T __unsafe_unretained const volatile>(); -} - -@class Foo; - -int main(int, char**) { - test_is_pointer<id>(); - test_is_pointer<id const>(); - test_is_pointer<id volatile>(); - test_is_pointer<id const volatile>(); - - test_is_pointer<Foo*>(); - test_is_pointer<Foo const*>(); - test_is_pointer<Foo volatile*>(); - test_is_pointer<Foo const volatile*>(); - - test_is_pointer<void*>(); - test_is_pointer<void const*>(); - test_is_pointer<void volatile*>(); - test_is_pointer<void const volatile*>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/type_traits/is_scalar.objc.pass.mm b/libcxx/test/libcxx-03/type_traits/is_scalar.objc.pass.mm deleted file mode 100644 index 951a90d..0000000 --- a/libcxx/test/libcxx-03/type_traits/is_scalar.objc.pass.mm +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// REQUIRES: has-fblocks -// ADDITIONAL_COMPILE_FLAGS: -fblocks - -// <type_traits> - -// std::is_scalar - -// Make sure we report that blocks are scalar types. - -#include <type_traits> - -struct Foo { }; -template <int> struct Arg { }; - -static_assert(std::is_scalar<void (^)(void)>::value, ""); -static_assert(std::is_scalar<void (^)()>::value, ""); -static_assert(std::is_scalar<void (^)(Arg<0>)>::value, ""); -static_assert(std::is_scalar<void (^)(Arg<0>, Arg<1>)>::value, ""); -static_assert(std::is_scalar<void (^)(Arg<0>, Arg<1>, Arg<2>)>::value, ""); -static_assert(std::is_scalar<Foo (^)(void)>::value, ""); -static_assert(std::is_scalar<Foo (^)()>::value, ""); -static_assert(std::is_scalar<Foo (^)(Arg<0>)>::value, ""); -static_assert(std::is_scalar<Foo (^)(Arg<0>, Arg<1>)>::value, ""); -static_assert(std::is_scalar<Foo (^)(Arg<0>, Arg<1>, Arg<2>)>::value, ""); - - -int main(int, char**) { - return 0; -} diff --git a/libcxx/test/libcxx-03/type_traits/is_specialization.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_specialization.compile.pass.cpp deleted file mode 100644 index 73dfc77..0000000 --- a/libcxx/test/libcxx-03/type_traits/is_specialization.compile.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// template <class _Tp, template <class...> class _Template> -// inline constexpr bool __is_specialization_v = true if and only if _Tp is a specialization of _Template -// -// Note instantiation for certain type combinations are ill-formed. These are -// tested in is_specialization.verify.cpp. - -#include <__type_traits/is_specialization.h> -#include <string_view> -#include <tuple> -#include <utility> - -#include "test_macros.h" - -// Simple types -static_assert(std::__is_specialization_v<std::pair<int, int>, std::pair>); -static_assert(!std::__is_specialization_v<std::pair<int, int>, std::tuple>); -static_assert(!std::__is_specialization_v<std::pair<int, int>, std::basic_string_view>); - -static_assert(std::__is_specialization_v<std::tuple<int>, std::tuple>); -static_assert(std::__is_specialization_v<std::tuple<int, float>, std::tuple>); -static_assert(std::__is_specialization_v<std::tuple<int, float, void*>, std::tuple>); - -static_assert(std::__is_specialization_v<std::string_view, std::basic_string_view>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(std::__is_specialization_v<std::wstring_view, std::basic_string_view>); -#endif - -// Nested types -static_assert(std::__is_specialization_v<std::pair<std::tuple<int>, int>, std::pair>); -static_assert(!std::__is_specialization_v<std::pair<std::tuple<int>, int>, std::tuple>); - -// cvref _Tp is not a specialization. -static_assert(!std::__is_specialization_v<const std::pair<int, int>, std::pair>); -static_assert(!std::__is_specialization_v<volatile std::pair<int, int>, std::pair>); -static_assert(!std::__is_specialization_v<const volatile std::pair<int, int>, std::pair>); - -static_assert(!std::__is_specialization_v<std::pair<int, int>&, std::pair>); -static_assert(!std::__is_specialization_v<const std::pair<int, int>&, std::pair>); -static_assert(!std::__is_specialization_v<volatile std::pair<int, int>&, std::pair>); -static_assert(!std::__is_specialization_v<const volatile std::pair<int, int>&, std::pair>); - -static_assert(!std::__is_specialization_v<std::pair<int, int>&&, std::pair>); -static_assert(!std::__is_specialization_v<const std::pair<int, int>&&, std::pair>); -static_assert(!std::__is_specialization_v<volatile std::pair<int, int>&&, std::pair>); -static_assert(!std::__is_specialization_v<const volatile std::pair<int, int>&&, std::pair>); diff --git a/libcxx/test/libcxx-03/type_traits/is_specialization.verify.cpp b/libcxx/test/libcxx-03/type_traits/is_specialization.verify.cpp deleted file mode 100644 index 51bff6d..0000000 --- a/libcxx/test/libcxx-03/type_traits/is_specialization.verify.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// template <class _Tp, template <class...> class _Template> -// inline constexpr bool __is_specialization_v = true if and only if _Tp is a specialization of _Template -// -// Tests the ill-formed instantiations. - -#include <__type_traits/is_specialization.h> -#include <array> -#include <utility> - -// expected-error-re@*:* {{{{could not match _Size against 'type-parameter-0-0'|different template parameters|template argument for non-type template parameter must be an expression}}}} -static_assert(!std::__is_specialization_v<std::pair<int, std::size_t>, std::array>); diff --git a/libcxx/test/libcxx-03/type_traits/lazy_metafunctions.pass.cpp b/libcxx/test/libcxx-03/type_traits/lazy_metafunctions.pass.cpp deleted file mode 100644 index 669bcdb..0000000 --- a/libcxx/test/libcxx-03/type_traits/lazy_metafunctions.pass.cpp +++ /dev/null @@ -1,131 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++03 - -// <type_traits> - -// __lazy_enable_if, __lazy_not, _And and _Or - -// Test the libc++ lazy meta-programming helpers in <type_traits> - -#include <__type_traits/conjunction.h> -#include <__type_traits/disjunction.h> -#include <__type_traits/negation.h> -#include <type_traits> - -#include "test_macros.h" - -template <class Type> -struct Identity : Type { - -}; - -typedef std::true_type TrueT; -typedef std::false_type FalseT; - -typedef Identity<TrueT> LazyTrueT; -typedef Identity<FalseT> LazyFalseT; - -// A type that cannot be instantiated -template <class T> -struct CannotInst { - static_assert(std::is_same<T, T>::value == false, ""); -}; - - -template <int Value> -struct NextInt { - typedef NextInt<Value + 1> type; - static const int value = Value; -}; - -template <int Value> -const int NextInt<Value>::value; - - -template <class Type> -struct HasTypeImp { - template <class Up, class = typename Up::type> - static TrueT test(int); - template <class> - static FalseT test(...); - - typedef decltype(test<Type>(0)) type; -}; - -// A metafunction that returns True if Type has a nested 'type' typedef -// and false otherwise. -template <class Type> -struct HasType : HasTypeImp<Type>::type {}; - - -void LazyNotTest() { - { - typedef std::_Not<LazyTrueT> NotT; - static_assert(std::is_same<typename NotT::type, FalseT>::value, ""); - static_assert(NotT::value == false, ""); - } - { - typedef std::_Not<LazyFalseT> NotT; - static_assert(std::is_same<typename NotT::type, TrueT>::value, ""); - static_assert(NotT::value == true, ""); - } - { - // Check that CannotInst<int> is not instantiated. - typedef std::_Not<CannotInst<int> > NotT; - - static_assert(std::is_same<NotT, NotT>::value, ""); - - } -} - -void LazyAndTest() { - { // Test that it acts as the identity function for a single value - static_assert(std::_And<LazyFalseT>::value == false, ""); - static_assert(std::_And<LazyTrueT>::value == true, ""); - } - { - static_assert(std::_And<LazyTrueT, LazyTrueT>::value == true, ""); - static_assert(std::_And<LazyTrueT, LazyFalseT>::value == false, ""); - static_assert(std::_And<LazyFalseT, LazyTrueT>::value == false, ""); - static_assert(std::_And<LazyFalseT, LazyFalseT>::value == false, ""); - } - { // Test short circuiting - CannotInst<T> should never be instantiated. - static_assert(std::_And<LazyFalseT, CannotInst<int>>::value == false, ""); - static_assert(std::_And<LazyTrueT, LazyFalseT, CannotInst<int>>::value == false, ""); - } -} - - -void LazyOrTest() { - { // Test that it acts as the identity function for a single value - static_assert(std::_Or<LazyFalseT>::value == false, ""); - static_assert(std::_Or<LazyTrueT>::value == true, ""); - } - { - static_assert(std::_Or<LazyTrueT, LazyTrueT>::value == true, ""); - static_assert(std::_Or<LazyTrueT, LazyFalseT>::value == true, ""); - static_assert(std::_Or<LazyFalseT, LazyTrueT>::value == true, ""); - static_assert(std::_Or<LazyFalseT, LazyFalseT>::value == false, ""); - } - { // Test short circuiting - CannotInst<T> should never be instantiated. - static_assert(std::_Or<LazyTrueT, CannotInst<int>>::value == true, ""); - static_assert(std::_Or<LazyFalseT, LazyTrueT, CannotInst<int>>::value == true, ""); - } -} - - -int main(int, char**) { - - LazyNotTest(); - LazyAndTest(); - LazyOrTest(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/type_traits/no_specializations.verify.cpp b/libcxx/test/libcxx-03/type_traits/no_specializations.verify.cpp deleted file mode 100644 index 897ae89..0000000 --- a/libcxx/test/libcxx-03/type_traits/no_specializations.verify.cpp +++ /dev/null @@ -1,197 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// Check that user-specializations are diagnosed -// See [meta.rqmts]/4, [meta.trans.other]/5, [meta.trans.other]/7 - -#include <type_traits> - -#include "test_macros.h" - -#if !__has_warning("-Winvalid-specialization") -// expected-no-diagnostics -#else -struct S {}; - -# define SPECIALIZE_TRAIT(Trait) \ - template <> \ - struct std::Trait<S> - -SPECIALIZE_TRAIT(add_const); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(add_cv); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(add_volatile); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(add_lvalue_reference); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(add_rvalue_reference); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(add_pointer); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(decay); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(invoke_result); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(make_unsigned); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_all_extents); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_const); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_cv); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_extent); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_pointer); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_reference); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(remove_volatile); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(underlying_type); // expected-error {{cannot be specialized}} - -# if TEST_STD_VER <= 17 -SPECIALIZE_TRAIT(result_of); // expected-error {{cannot be specialized}} -# endif - -# if TEST_STD_VER >= 20 -SPECIALIZE_TRAIT(remove_cvref); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(type_identity); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(unwrap_reference); // expected-error {{cannot be specialized}} -SPECIALIZE_TRAIT(unwrap_ref_decay); // expected-error {{cannot be specialized}} -# endif - -# undef SPECIALIZE_TRAIT -# define SPECIALIZE_UTT(Trait) \ - template <> \ - struct std::Trait<S>; \ - template <> \ - inline constexpr bool std::Trait##_v<S> = false - -# define SPECIALIZE_BTT(Trait) \ - template <> \ - struct std::Trait<S, S>; \ - template <> \ - inline constexpr bool std::Trait##_v<S, S> = false - -SPECIALIZE_UTT(alignment_of); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(conjunction); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(disjunction); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(extent); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(has_unique_object_representations); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_abstract); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_aggregate); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_arithmetic); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_array); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_base_of); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_class); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_compound); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_const); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_convertible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_copy_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_copy_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_default_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_destructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_empty); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_enum); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_final); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_floating_point); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_function); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_fundamental); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_integral); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_invocable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_invocable_r); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_lvalue_reference); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_member_pointer); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_member_object_pointer); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_member_function_pointer); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_move_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_move_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_nothrow_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_copy_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_copy_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_default_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_destructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_move_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_move_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_invocable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_nothrow_invocable_r); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_nothrow_swappable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_nothrow_swappable_with); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_null_pointer); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_object); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_pod); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_pointer); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_polymorphic); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_reference); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_rvalue_reference); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_same); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_scalar); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_signed); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_standard_layout); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_swappable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_swappable_with); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivial); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_trivially_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_copy_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_copy_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_copyable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_default_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_destructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_move_assignable); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_trivially_move_constructible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_union); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_unsigned); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_void); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_volatile); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(negation); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(rank); // expected-error 2 {{cannot be specialized}} - -# if TEST_STD_VER <= 17 -SPECIALIZE_UTT(is_literal_type); // expected-error 2 {{cannot be specialized}} -# endif - -# if TEST_STD_VER >= 20 -SPECIALIZE_UTT(is_bounded_array); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_BTT(is_nothrow_convertible); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_unbounded_array); // expected-error 2 {{cannot be specialized}} -# endif - -# if TEST_STD_VER >= 23 -SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}} -SPECIALIZE_UTT(is_scoped_enum); // expected-error 2 {{cannot be specialized}} -# if __has_builtin(__reference_constructs_from_temporary) -SPECIALIZE_BTT(reference_constructs_from_temporary); // expected-error 2 {{cannot be specialized}} -# endif -# if __has_builtin(__reference_converts_from_temporary) -SPECIALIZE_BTT(reference_converts_from_temporary); // expected-error 2 {{cannot be specialized}} -# endif -# endif - -# if TEST_STD_VER >= 26 -SPECIALIZE_BTT(is_virtual_base_of); // expected-error 2 {{cannot be specialized}} -# endif - -# undef SPECIALIZE_UTT -# undef SPECIALIZE_BTT - -template <> -struct std::aligned_storage<1, 3>; // expected-error {{cannot be specialized}} - -template <> -struct std::aligned_union<1, S>; // expected-error {{cannot be specialized}} - -template <> -struct std::conditional<true, S, S>; // expected-error {{cannot be specialized}} - -template <> -struct std::enable_if<true, S>; // expected-error {{cannot be specialized}} - -# if TEST_STD_VER >= 20 -template <> -struct std::integral_constant<S, {}>; // expected-error {{cannot be specialized}} - -template <> -struct std::common_reference<S>; // expected-error {{cannot be specialized}} -template <> -struct std::common_reference<S, S>; // expected-error {{cannot be specialized}} -template <> -struct std::common_reference<S, S, S>; // expected-error {{cannot be specialized}} -# endif -#endif diff --git a/libcxx/test/libcxx-03/utilities/any/allocator.pass.cpp b/libcxx/test/libcxx-03/utilities/any/allocator.pass.cpp deleted file mode 100644 index eab3ca8..0000000 --- a/libcxx/test/libcxx-03/utilities/any/allocator.pass.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <any> - -// Check that we're consistently using std::allocator_traits to -// allocate/deallocate/construct/destroy objects in std::any. -// See https://llvm.org/PR45099 for details. - -#include <any> -#include <cassert> -#include <cstddef> -#include <memory> -#include <new> -#include <type_traits> -#include <utility> - -#include "test_macros.h" - - -// Make sure we don't fit in std::any's SBO -struct Large { char big[sizeof(std::any) + 1]; }; - -// Make sure we fit in std::any's SBO -struct Small { }; - -bool Large_was_allocated = false; -bool Large_was_constructed = false; -bool Large_was_destroyed = false; -bool Large_was_deallocated = false; - -bool Small_was_constructed = false; -bool Small_was_destroyed = false; - -template <> -struct std::allocator<Large> { - using value_type = Large; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using propagate_on_container_move_assignment = std::true_type; - using is_always_equal = std::true_type; - - Large* allocate(std::size_t n) { - Large_was_allocated = true; - return static_cast<Large*>(::operator new(n * sizeof(Large))); - } - - template <typename... Args> - void construct(Large* p, Args&&... args) { - new (p) Large(std::forward<Args>(args)...); - Large_was_constructed = true; - } - - void destroy(Large* p) { - p->~Large(); - Large_was_destroyed = true; - } - - void deallocate(Large* p, std::size_t) { - Large_was_deallocated = true; - return ::operator delete(p); - } -}; - -template <> -struct std::allocator<Small> { - using value_type = Small; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using propagate_on_container_move_assignment = std::true_type; - using is_always_equal = std::true_type; - - Small* allocate(std::size_t) { - assert(false); - return nullptr; - } - - template <typename... Args> - void construct(Small* p, Args&&... args) { - new (p) Small(std::forward<Args>(args)...); - Small_was_constructed = true; - } - - void destroy(Small* p) { - p->~Small(); - Small_was_destroyed = true; - } - - void deallocate(Small*, std::size_t) { assert(false); } -}; - -int main(int, char**) { - // Test large types - { - { - std::any a = Large(); - (void)a; - - assert(Large_was_allocated); - assert(Large_was_constructed); - } - - assert(Large_was_destroyed); - assert(Large_was_deallocated); - } - - // Test small types - { - { - std::any a = Small(); - (void)a; - - assert(Small_was_constructed); - } - - assert(Small_was_destroyed); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/any/size_and_alignment.pass.cpp b/libcxx/test/libcxx-03/utilities/any/size_and_alignment.pass.cpp deleted file mode 100644 index 230ff8c..0000000 --- a/libcxx/test/libcxx-03/utilities/any/size_and_alignment.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <any> - -// Check that the size and alignment of any are what we expect. - -#include <any> - -#include "test_macros.h" - -int main(int, char**) -{ - static_assert(sizeof(std::any) == sizeof(void*)*4, ""); - static_assert(alignof(std::any) == alignof(void*), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/any/small_type.pass.cpp b/libcxx/test/libcxx-03/utilities/any/small_type.pass.cpp deleted file mode 100644 index 65c7d34..0000000 --- a/libcxx/test/libcxx-03/utilities/any/small_type.pass.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <any> - -// Check that the size and alignment of any are what we expect. - -#include <any> -#include "test_macros.h" -#include "any_helpers.h" - -constexpr std::size_t BufferSize = (sizeof(void*) * 3); -constexpr std::size_t BufferAlignment = alignof(void*); -// Clang doesn't like "alignof(BufferAlignment * 2)" due to PR13986. -// So we create "DoubleBufferAlignment" instead. -constexpr std::size_t DoubleBufferAlignment = BufferAlignment * 2; - -class SmallThrowsDtor -{ -public: - SmallThrowsDtor() {} - SmallThrowsDtor(SmallThrowsDtor const &) noexcept {} - SmallThrowsDtor(SmallThrowsDtor &&) noexcept {} - ~SmallThrowsDtor() noexcept(false) {} -}; - - -struct alignas(1) MaxSizeType { - char buff[BufferSize]; -}; - -struct alignas(BufferAlignment) MaxAlignType { -}; - -struct alignas(BufferAlignment) MaxSizeAndAlignType { - char buff[BufferSize]; -}; - - -struct alignas(1) OverSizeType { - char buff[BufferSize + 1]; -}; - -struct alignas(DoubleBufferAlignment) OverAlignedType { -}; - -struct alignas(DoubleBufferAlignment) OverSizeAndAlignedType { - char buff[BufferSize + 1]; -}; - -int main(int, char**) -{ - using std::__any_imp::_IsSmallObject; - static_assert(_IsSmallObject<small>::value, ""); - static_assert(_IsSmallObject<void*>::value, ""); - static_assert(!_IsSmallObject<SmallThrowsDtor>::value, ""); - static_assert(!_IsSmallObject<large>::value, ""); - { - // Check a type that meets the size requirement *exactly* and has - // a lesser alignment requirement is considered small. - typedef MaxSizeType T; - static_assert(sizeof(T) == BufferSize, ""); - static_assert(alignof(T) < BufferAlignment, ""); - static_assert(_IsSmallObject<T>::value, ""); - } - { - // Check a type that meets the alignment requirement *exactly* and has - // a lesser size is considered small. - typedef MaxAlignType T; - static_assert(sizeof(T) < BufferSize, ""); - static_assert(alignof(T) == BufferAlignment, ""); - static_assert(_IsSmallObject<T>::value, ""); - } - { - // Check a type that meets the size and alignment requirements *exactly* - // is considered small. - typedef MaxSizeAndAlignType T; - static_assert(sizeof(T) == BufferSize, ""); - static_assert(alignof(T) == BufferAlignment, ""); - static_assert(_IsSmallObject<T>::value, ""); - } - { - // Check a type that meets the alignment requirements but is over-sized - // is not considered small. - typedef OverSizeType T; - static_assert(sizeof(T) > BufferSize, ""); - static_assert(alignof(T) < BufferAlignment, ""); - static_assert(!_IsSmallObject<T>::value, ""); - } - { - // Check a type that meets the size requirements but is over-aligned - // is not considered small. - typedef OverAlignedType T; - static_assert(sizeof(T) < BufferSize, ""); - static_assert(alignof(T) > BufferAlignment, ""); - static_assert(!_IsSmallObject<T>::value, ""); - } - { - // Check a type that exceeds both the size an alignment requirements - // is not considered small. - typedef OverSizeAndAlignedType T; - static_assert(sizeof(T) > BufferSize, ""); - static_assert(alignof(T) > BufferAlignment, ""); - static_assert(!_IsSmallObject<T>::value, ""); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/assert.exception_guard.no_exceptions.pass.cpp b/libcxx/test/libcxx-03/utilities/assert.exception_guard.no_exceptions.pass.cpp deleted file mode 100644 index c6ddb8b..0000000 --- a/libcxx/test/libcxx-03/utilities/assert.exception_guard.no_exceptions.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03 -// REQUIRES: libcpp-hardening-mode=debug -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing -// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions - -#include <__utility/exception_guard.h> - -#include "check_assertion.h" - -int main(int, char**) { - TEST_LIBCPP_ASSERT_FAILURE( - std::__make_exception_guard([] {}), "__exception_guard not completed with exceptions disabled"); -} diff --git a/libcxx/test/libcxx-03/utilities/exception_guard.no_exceptions.pass.cpp b/libcxx/test/libcxx-03/utilities/exception_guard.no_exceptions.pass.cpp deleted file mode 100644 index 60cf4f7..0000000 --- a/libcxx/test/libcxx-03/utilities/exception_guard.no_exceptions.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// ADDITIONAL_COMPILE_FLAGS: -fno-exceptions - -#include <__utility/exception_guard.h> -#include <utility> - -int main(int, char**) { - auto guard = std::__make_exception_guard([] {}); - auto guard2 = std::move(guard); - guard2.__complete(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/exception_guard.pass.cpp b/libcxx/test/libcxx-03/utilities/exception_guard.pass.cpp deleted file mode 100644 index 0728959..0000000 --- a/libcxx/test/libcxx-03/utilities/exception_guard.pass.cpp +++ /dev/null @@ -1,161 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// UNSUPPORTED: no-exceptions - -#include <__utility/exception_guard.h> -#include <cassert> -#include <type_traits> -#include <utility> - -#include "test_macros.h" - -TEST_CONSTEXPR_CXX20 bool test() { - // Make sure the transaction is rolled back if it is not marked as complete when - // it goes out of scope. - { - bool rolled_back = false; - { - auto rollback = [&] { rolled_back = true; }; - std::__exception_guard<decltype(rollback)> g(rollback); - } - assert(rolled_back); - } - - // Make sure the transaction is not rolled back if it is marked as complete when - // it goes out of scope. - { - bool rolled_back = false; - { - auto rollback = [&] { rolled_back = true; }; - std::__exception_guard<decltype(rollback)> g(rollback); - g.__complete(); - } - assert(!rolled_back); - } - - // Make sure that we will perform the right number of rollbacks when a transaction has - // been moved around - { - // When we don't complete it (exactly 1 rollback should happen) - { - int rollbacks = 0; - { - auto rollback = [&] { ++rollbacks; }; - std::__exception_guard<decltype(rollback)> g(rollback); - auto other = std::move(g); - } - assert(rollbacks == 1); - } - - // When we do complete it (no rollbacks should happen) - { - int rollbacks = 0; - { - auto rollback = [&] { ++rollbacks; }; - std::__exception_guard<decltype(rollback)> g(rollback); - auto other = std::move(g); - other.__complete(); - } - assert(rollbacks == 0); - } - } - - // Basic properties of the type - { - struct Rollback { void operator()() const { } }; - using Transaction = std::__exception_guard<Rollback>; - - static_assert(!std::is_default_constructible<Transaction>::value, ""); - - static_assert(!std::is_copy_constructible<Transaction>::value, ""); - static_assert( std::is_move_constructible<Transaction>::value, ""); - - static_assert(!std::is_copy_assignable<Transaction>::value, ""); - static_assert(!std::is_move_assignable<Transaction>::value, ""); - - // Check noexcept-ness of a few operations - { - struct ThrowOnMove { - ThrowOnMove(ThrowOnMove&&) noexcept(false) { } - void operator()() const { } - }; - using ThrowOnMoveTransaction = std::__exception_guard<ThrowOnMove>; - - ASSERT_NOEXCEPT(std::declval<Transaction>().__complete()); - static_assert( std::is_nothrow_move_constructible<Transaction>::value, ""); - static_assert(!std::is_nothrow_move_constructible<ThrowOnMoveTransaction>::value, ""); - } - } - - return true; -} - -void test_exceptions() { -#ifndef TEST_HAS_NO_EXCEPTIONS - // Make sure the rollback is performed when an exception is thrown during the - // lifetime of the transaction. - { - bool rolled_back = false; - auto rollback = [&] { rolled_back = true; }; - try { - std::__exception_guard<decltype(rollback)> g(rollback); - throw 0; - } catch (...) { } - assert(rolled_back); - } - - // Make sure we don't roll back if an exception is thrown but the transaction - // has been marked as complete when that happens. - { - bool rolled_back = false; - auto rollback = [&] { rolled_back = true; }; - try { - std::__exception_guard<decltype(rollback)> g(rollback); - g.__complete(); - throw 0; - } catch (...) { } - assert(!rolled_back); - } - - // Make sure __exception_guard does not rollback if the transaction is marked as - // completed within a destructor. - { - struct S { - explicit S(bool& x) : x_(x) { } - - ~S() { - auto rollback = [this]{ x_ = true; }; - std::__exception_guard<decltype(rollback)> g(rollback); - g.__complete(); - } - - bool& x_; - }; - - bool rolled_back = false; - try { - S s(rolled_back); - throw 0; - } catch (...) { - assert(!rolled_back); - } - } -#endif // TEST_HAS_NO_EXCEPTIONS -} - -int main(int, char**) { - test(); - test_exceptions(); -#if TEST_STD_VER > 17 - static_assert(test(), ""); -#endif - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/and_then.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/and_then.mandates.verify.cpp deleted file mode 100644 index c46ab63..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/and_then.mandates.verify.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// template<class F> constexpr auto and_then(F&& f) &; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F, decltype(value())>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -// template<class F> constexpr auto and_then(F&& f) const &; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F, decltype(value())>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -// template<class F> constexpr auto and_then(F&& f) &&; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F, decltype(value())>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -// template<class F> constexpr auto and_then(F&& f) const &&; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F, decltype(value())>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -#include <expected> -#include <utility> - -struct NotSameAsInt {}; - -int lval_return_not_std_expected(int&) { return 0; } -int clval_return_not_std_expected(const int&) { return 0; } -int rval_return_not_std_expected(int&&) { return 0; } -int crval_return_not_std_expected(const int&&) { return 0; } - -std::expected<int, NotSameAsInt> lval_error_type_not_same_as_int(int&) { return {}; } -std::expected<int, NotSameAsInt> clval_error_type_not_same_as_int(const int&) { return {}; } -std::expected<int, NotSameAsInt> rval_error_type_not_same_as_int(int&&) { return {}; } -std::expected<int, NotSameAsInt> crval_error_type_not_same_as_int(const int&&) { return {}; } - -// clang-format off -void test() { - // Test & overload - { - // U is not a specialization of std::expected - { - std::expected<int, int> f1(1); - f1.and_then(lval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - std::expected<int, int> f1(1); - f1.and_then(lval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must have the same error_type as this expected}} - } - } - - // Test const& overload - { - // U is not a specialization of std::expected - { - const std::expected<int, int> f1(1); - f1.and_then(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(const int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - const std::expected<int, int> f1(1); - f1.and_then(clval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(const int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(value()) must have the same error_type as this expected}} - - } - } - - // Test && overload - { - // U is not a specialization of std::expected - { - std::expected<int, int> f1(1); - std::move(f1).and_then(rval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - std::expected<int, int> f1(1); - std::move(f1).and_then(rval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must have the same error_type as this expected}} - } - } - - // Test const&& overload - { - // U is not a specialization of std::expected - { - const std::expected<int, int> f1(1); - std::move(f1).and_then(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<int (&)(const int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - const std::expected<int, int> f1(1); - std::move(f1).and_then(crval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::and_then<std::expected<int, NotSameAsInt> (&)(const int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(value())) must have the same error_type as this expected}} - } - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.arrow.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.arrow.pass.cpp deleted file mode 100644 index 47481bcb..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.arrow.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// constexpr const T* operator->() const noexcept; -// constexpr T* operator->() noexcept; -// -// Preconditions: has_value() is true. - -#include <expected> -#include <utility> - -#include "check_assertion.h" - -int main(int, char**) { - std::expected<int, int> e{std::unexpect, 5}; - TEST_LIBCPP_ASSERT_FAILURE(e.operator->(), "expected::operator-> requires the expected to contain a value"); - TEST_LIBCPP_ASSERT_FAILURE(std::as_const(e).operator->(), "expected::operator-> requires the expected to contain a value"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.deref.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.deref.pass.cpp deleted file mode 100644 index 5ab43d3..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.deref.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// constexpr const T& operator*() const & noexcept; -// constexpr T& operator*() & noexcept; -// constexpr T&& operator*() && noexcept; -// constexpr const T&& operator*() const && noexcept; -// -// Preconditions: has_value() is true. - -#include <expected> -#include <utility> - -#include "check_assertion.h" - -int main(int, char**) { - std::expected<int, int> e{std::unexpect, 5}; - TEST_LIBCPP_ASSERT_FAILURE(*e, "expected::operator* requires the expected to contain a value"); - TEST_LIBCPP_ASSERT_FAILURE(*std::as_const(e), "expected::operator* requires the expected to contain a value"); - TEST_LIBCPP_ASSERT_FAILURE(*std::move(e), "expected::operator* requires the expected to contain a value"); - TEST_LIBCPP_ASSERT_FAILURE(*std::move(std::as_const(e)), "expected::operator* requires the expected to contain a value"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.error.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.error.pass.cpp deleted file mode 100644 index 92bf305..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/assert.error.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// constexpr const E& error() const & noexcept; -// constexpr E& error() & noexcept; -// constexpr E&& error() && noexcept; -// constexpr const E&& error() const && noexcept; -// -// Preconditions: has_value() is false. - -#include <expected> -#include <utility> - -#include "check_assertion.h" - -int main(int, char**) { - std::expected<int, int> e{std::in_place, 5}; - TEST_LIBCPP_ASSERT_FAILURE(e.error(), "expected::error requires the expected to contain an error"); - TEST_LIBCPP_ASSERT_FAILURE(std::as_const(e).error(), "expected::error requires the expected to contain an error"); - TEST_LIBCPP_ASSERT_FAILURE(std::move(e).error(), "expected::error requires the expected to contain an error"); - TEST_LIBCPP_ASSERT_FAILURE(std::move(std::as_const(e)).error(), "expected::error requires the expected to contain an error"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/error_or.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/error_or.mandates.verify.cpp deleted file mode 100644 index d833f72..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/error_or.mandates.verify.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// template<class G = E> constexpr E error_or(G&&) const &; -// Mandates: is_copy_constructible_v<G> is true and is_convertible_v<U, E> is true. - -// template<class G = E> constexpr E error_or(G&&) &&; -// Mandates: is_move_constructible_v<G> is true and is_convertible_v<U, E> is true. - -#include <expected> -#include <utility> - -struct NonCopyable { - NonCopyable(int) {} - NonCopyable(const NonCopyable&) = delete; -}; - -struct NonMovable { - NonMovable(int) {} - NonMovable(NonMovable&&) = delete; -}; - -struct NotConvertibleFromInt {}; - -// clang-format off -void test() { - // const & overload - // !is_copy_constructible_v<G>, - { - const std::expected<int, NonCopyable> f1(std::unexpect, 0); - f1.error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<int, NonCopyable>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be copy constructible}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - } - - // const & overload - // !is_convertible_v<U, T> - { - const std::expected<int, NotConvertibleFromInt> f1(std::unexpect, NotConvertibleFromInt{}); - f1.error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<int, NotConvertibleFromInt>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to error_type}} - // expected-error-re@*:* {{no viable conversion from returned value of type{{.*}}}} - - } - - // && overload - // !is_move_constructible_v<T>, - { - std::expected<int, NonMovable> f1(std::unexpect, 0); - std::move(f1).error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<int, NonMovable>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be move constructible}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - } - - // && overload - // !is_convertible_v<U, T> - { - std::expected<int, NotConvertibleFromInt> f1(std::unexpect, NotConvertibleFromInt{}); - std::move(f1).error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<int, NotConvertibleFromInt>::error_or<int>' requested here}} - //expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to error_type}} - // expected-error-re@*:* {{no viable conversion from returned value of type{{.*}}}} - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/no_unique_address.compile.pass.cpp deleted file mode 100644 index 8c2b71f3..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// clang-cl and cl currently don't support [[no_unique_address]] -// XFAIL: msvc - -// test [[no_unique_address]] is applied to the union - -#include <__type_traits/datasizeof.h> -#include <expected> -#include <optional> -#include <memory> - -struct Empty {}; - -struct A { - int x_; - int y_; -}; - -struct B : public A { - int z_; - short z2_; - virtual ~B() = default; -}; - -struct BoolWithPadding { - explicit operator bool() { return b; } - -private: - alignas(1024) bool b = false; -}; - -static_assert(sizeof(std::expected<Empty, Empty>) == sizeof(bool)); -static_assert(sizeof(std::expected<Empty, A>) == 2 * sizeof(int) + alignof(std::expected<Empty, A>)); -static_assert(sizeof(std::expected<Empty, B>) == sizeof(B)); -static_assert(sizeof(std::expected<A, Empty>) == 2 * sizeof(int) + alignof(std::expected<A, Empty>)); -static_assert(sizeof(std::expected<A, A>) == 2 * sizeof(int) + alignof(std::expected<A, A>)); -static_assert(sizeof(std::expected<B, Empty>) == sizeof(B)); -static_assert(sizeof(std::expected<B, B>) == sizeof(B)); - -// Check that `expected`'s datasize is large enough for the parameter type(s). -static_assert(sizeof(std::expected<BoolWithPadding, Empty>) == - std::__datasizeof_v<std::expected<BoolWithPadding, Empty>>); -static_assert(sizeof(std::expected<Empty, BoolWithPadding>) == - std::__datasizeof_v<std::expected<Empty, BoolWithPadding>>); - -// In this case, there should be tail padding in the `expected` because `A` -// itself does _not_ have tail padding. -static_assert(sizeof(std::expected<A, A>) > std::__datasizeof_v<std::expected<A, A>>); - -// Test with some real types. -static_assert(sizeof(std::expected<std::optional<int>, int>) == 8); -static_assert(std::__datasizeof_v<std::expected<std::optional<int>, int>> == 8); - -static_assert(sizeof(std::expected<int, std::optional<int>>) == 8); -static_assert(std::__datasizeof_v<std::expected<int, std::optional<int>>> == 8); - -static_assert(sizeof(std::expected<int, int>) == 8); -static_assert(std::__datasizeof_v<std::expected<int, int>> == 5); - -// clang-format off -static_assert(std::__datasizeof_v<int> == 4); -static_assert(std::__datasizeof_v<std::expected<int, int>> == 5); -static_assert(std::__datasizeof_v<std::expected<std::expected<int, int>, int>> == 8); -static_assert(std::__datasizeof_v<std::expected<std::expected<std::expected<int, int>, int>, int>> == 9); -static_assert(std::__datasizeof_v<std::expected<std::expected<std::expected<std::expected<int, int>, int>, int>, int>> == 12); -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/noexcept.extension.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/noexcept.extension.compile.pass.cpp deleted file mode 100644 index 4f8c4ef..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/noexcept.extension.compile.pass.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// test libc++ noexcept extensions on operations of std::expected<T, E> - -#include <expected> -#include <type_traits> -#include <utility> - -#include "../types.h" - -// expected(); -static_assert(std::is_nothrow_default_constructible_v<std::expected<int, int>>); -static_assert(!std::is_nothrow_default_constructible_v<std::expected<DefaultMayThrow, int>>); - -// expected(const expected&) -static_assert(std::is_nothrow_copy_constructible_v<std::expected<int, int>>); -static_assert(!std::is_nothrow_copy_constructible_v<std::expected<CopyMayThrow, int>>); -static_assert(!std::is_nothrow_copy_constructible_v<std::expected<int, CopyMayThrow>>); - -// expected(const expected<OtherT, OtherE>&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<long, long>, - const std::expected<int, int>&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromCopyIntMayThrow, long>, - const std::expected<int, int>&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<long, ConvertFromCopyIntMayThrow>, - const std::expected<int, int>&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromCopyIntMayThrow, ConvertFromCopyIntMayThrow>, // - const std::expected<int, int>&>); - -// expected(expected<OtherT, OtherE>&&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<long, long>, - std::expected<int, int>&&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromMoveIntMayThrow, long>, - std::expected<int, int>&&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<long, ConvertFromMoveIntMayThrow>, - std::expected<int, int>&&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromMoveIntMayThrow, ConvertFromMoveIntMayThrow>, // - std::expected<int, int>&&>); - -// expected(U&&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<int, int>, - const int&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromCopyIntMayThrow, int>, - const int&>); - -// expected(const unexpected<OtherE>&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<int, long>, - const std::unexpected<int>&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<int, ConvertFromCopyIntMayThrow>, - const std::unexpected<int>&>); - -// expected(unexpected<OtherE>&&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<int, long>, - std::unexpected<int>&&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<int, ConvertFromMoveIntMayThrow>, - std::unexpected<int>&&>); - -// expected(in_place_t, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::expected<int, int>, - std::in_place_t, - const int&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromCopyIntMayThrow, int>, - std::in_place_t, - const int&>); - -// expected(in_place_t, initializer_list<U>, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::expected<ConvertFromInitializerListNoexcept, int>, - std::in_place_t, - std::initializer_list<int>>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<ConvertFromInitializerListMayThrow, int>, - std::in_place_t, - std::initializer_list<int>>); - -// expected(unexpect_t, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::expected<int, int>, - std::unexpect_t, - const int&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<int, ConvertFromCopyIntMayThrow>, - std::unexpect_t, - const int&>); - -// expected(unexpect_t, initializer_list<U>, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::expected<int, ConvertFromInitializerListNoexcept>, - std::unexpect_t, - std::initializer_list<int>>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<int, ConvertFromInitializerListMayThrow>, - std::unexpect_t, - std::initializer_list<int>>); - -// expected& operator=(const expected&) -static_assert(std::is_nothrow_copy_assignable_v<std::expected<int, int>>); -static_assert(!std::is_nothrow_copy_assignable_v<std::expected<CopyConstructMayThrow, int>>); -static_assert(!std::is_nothrow_copy_assignable_v<std::expected<CopyAssignMayThrow, int>>); -static_assert(!std::is_nothrow_copy_assignable_v<std::expected<int, CopyConstructMayThrow>>); -static_assert(!std::is_nothrow_copy_assignable_v<std::expected<int, CopyAssignMayThrow>>); diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/or_else.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/or_else.mandates.verify.cpp deleted file mode 100644 index af1fa53..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/or_else.mandates.verify.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// template<class F> constexpr auto or_else(F&& f) &; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -// template<class F> constexpr auto or_else(F&& f) const &; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -// template<class F> constexpr auto or_else(F&& f) &&; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -// template<class F> constexpr auto or_else(F&& f) const &&; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -#include <expected> -#include <utility> - -struct NotSameAsInt {}; - -int lval_return_not_std_expected(int&) { return 0; } -int clval_return_not_std_expected(const int&) { return 0; } -int rval_return_not_std_expected(int&&) { return 0; } -int crval_return_not_std_expected(const int&&) { return 0; } - -std::expected<NotSameAsInt, int> lval_error_type_not_same_as_int(int&) { return {}; } -std::expected<NotSameAsInt, int> clval_error_type_not_same_as_int(const int&) { return {}; } -std::expected<NotSameAsInt, int> rval_error_type_not_same_as_int(int&&) { return {}; } -std::expected<NotSameAsInt, int> crval_error_type_not_same_as_int(const int&&) { return {}; } - -// clang-format off -void test() { - // Test & overload - { - // G is not a specialization of std::expected - { - std::expected<int, int> f1(std::unexpected<int>(1)); - f1.or_else(lval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<G:value_type, T> - { - std::expected<int, int> f1(std::unexpected<int>(1)); - f1.or_else(lval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<std::expected<NotSameAsInt, int> (&)(int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must have the same value_type as this expected}} - } - } - - // Test const& overload - { - // G is not a specialization of std::expected - { - const std::expected<int, int> f1(std::unexpected<int>(1)); - f1.or_else(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(const int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<G:value_type, T> - { - const std::expected<int, int> f1(std::unexpected<int>(1)); - f1.or_else(clval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<std::expected<NotSameAsInt, int> (&)(const int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must have the same value_type as this expected}} - } - } - - // Test && overload - { - // G is not a specialization of std::expected - { - std::expected<int, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(rval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<G:value_type, T> - { - std::expected<int, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(rval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<std::expected<NotSameAsInt, int> (&)(int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must have the same value_type as this expected}} - } - } - - // Test const&& overload - { - // G is not a specialization of std::expected - { - const std::expected<int, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<int (&)(const int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<G:value_type, T> - { - const std::expected<int, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(crval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<int, int>::or_else<std::expected<NotSameAsInt, int> (&)(const int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must have the same value_type as this expected}} - } - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/transform_error.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/transform_error.mandates.verify.cpp deleted file mode 100644 index 6137409..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/transform_error.mandates.verify.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Clang-18 fixed some spurious clang diagnostics. Once clang-18 is the -// minimum required version these obsolete tests can be removed. -// TODO(LLVM-20) remove spurious clang diagnostic tests. - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix -// which break the tests. But #102851 will turn it into an error, making the test pass. -// However, upstream libcxx buildbots do not build clang from source while testing, so -// this tests still expected to fail on these bots. -// -// TODO(LLVM 22): Remove '0-1' from 'expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}' -// and remove 'expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}' -// once LLVM 22 releases. See https://github.com/llvm/llvm-project/issues/104885. - -// Test the mandates - -// template<class F> constexpr auto transform_error(F&& f) &; -// template<class F> constexpr auto transform_error(F&& f) const &; -// -// Let G be remove_cv_t<invoke_result_t<F, decltype(error())>> -// G is a valid template argument for unexpected ([expected.un.general]) and the declaration -// G g(invoke(std::forward<F>(f), error())); is well-formed. - -// template<class F> constexpr auto transform_error(F&& f) &&; -// template<class F> constexpr auto transform_error(F&& f) const &&; -// -// Let G be remove_cv_t<invoke_result_t<F, decltype(std::move(error()))>>. -// G is a valid template argument for unexpected ([expected.un.general]) and the declaration -// G g(invoke(std::forward<F>(f), std::move(error()))); is well-formed. - -#include <expected> -#include <utility> - -static int val; - -template <class T> -std::unexpected<int> return_unexpected(T) { - return std::unexpected<int>(1); -} - -template <class T> -int& return_no_object(T) { - return val; -} - -// clang-format off -void test() { - - // Test & overload - { - std::expected<int, int> e; - e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - // expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}} - // expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}} - - e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - // expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}} - // expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}} - } - - // Test const& overload - { - const std::expected<int, int> e; - e.transform_error(return_unexpected<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - e.transform_error(return_no_object<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - } - - // Test && overload - { - std::expected<int, int> e; - std::move(e).transform_error(return_unexpected<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - std::move(e).transform_error(return_no_object<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - } - - // Test const&& overload - { - const std::expected<int, int> e; - std::move(e).transform_error(return_unexpected<const int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - std::move(e).transform_error(return_no_object<const int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/value.observers.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/value.observers.verify.cpp deleted file mode 100644 index d2b62a9..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/value.observers.verify.cpp +++ /dev/null @@ -1,131 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// constexpr T& value() & ; -// constexpr const T& value() const &; -// Mandates: is_copy_constructible_v<E> is true. - -// constexpr T&& value() &&; -// constexpr const T&& value() const &&; -// Mandates: is_copy_constructible_v<E> is true and is_constructible_v<E, decltype(std::move(error()))> is true. - -#include <expected> -#include <utility> - -#include "MoveOnly.h" - -struct CopyConstructible { - constexpr CopyConstructible() = default; - constexpr CopyConstructible(const CopyConstructible&) = default; -}; - -struct CopyConstructibleButNotMoveConstructible { - constexpr CopyConstructibleButNotMoveConstructible() = default; - constexpr CopyConstructibleButNotMoveConstructible(const CopyConstructibleButNotMoveConstructible&) = default; - constexpr CopyConstructibleButNotMoveConstructible(CopyConstructibleButNotMoveConstructible&&) = delete; - constexpr CopyConstructibleButNotMoveConstructible(const CopyConstructibleButNotMoveConstructible&&) = delete; -}; - -struct CopyConstructibleAndMoveConstructible { - constexpr CopyConstructibleAndMoveConstructible() = default; - constexpr CopyConstructibleAndMoveConstructible(const CopyConstructibleAndMoveConstructible&) = default; - constexpr CopyConstructibleAndMoveConstructible(CopyConstructibleAndMoveConstructible&&) = default; -}; - -// clang-format off -void test() { - - // Test & overload - { - // is_copy_constructible_v<E> is true. - { - std::expected<int, CopyConstructible> e; - [[maybe_unused]] auto val = e.value(); - } - - // is_copy_constructible_v<E> is false. - { - std::expected<int, MoveOnly> e; - [[maybe_unused]] auto val = e.value(); - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be copy constructible}} - } - } - - // Test const& overload - { - // is_copy_constructible_v<E> is true. - { - const std::expected<int, CopyConstructible> e; - [[maybe_unused]] auto val = e.value(); - } - - // is_copy_constructible_v<E> is false. - { - const std::expected<int, MoveOnly> e; - [[maybe_unused]] auto val = e.value(); - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be copy constructible}} - } - } - - // Test && overload - { - // is_copy_constructible_v<E> is false. - { - std::expected<int, MoveOnly> e; - [[maybe_unused]] auto val = std::move(e).value(); - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be both copy constructible and constructible from decltype(std::move(error()))}} - } - - // is_copy_constructible_v<E> is true and is_constructible_v<E, decltype(std::move(error()))> is true. - { - std::expected<int, CopyConstructibleAndMoveConstructible> e; - [[maybe_unused]] auto val = std::move(e).value(); - } - - // is_copy_constructible_v<E> is true and is_constructible_v<E, decltype(std::move(error()))> is false. - { - std::expected<int, CopyConstructibleButNotMoveConstructible> e; - [[maybe_unused]] auto val = std::move(e).value(); - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be both copy constructible and constructible from decltype(std::move(error()))}} - } - } - - // Test const&& overload - { - // is_copy_constructible_v<E> is false. - { - const std::expected<int, MoveOnly> e; - [[maybe_unused]] auto val = std::move(e).value(); - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be both copy constructible and constructible from decltype(std::move(error()))}} - } - - // is_copy_constructible_v<E> is true and is_constructible_v<E, decltype(std::move(error()))> is true. - { - const std::expected<int, CopyConstructibleAndMoveConstructible> e; - [[maybe_unused]] auto val = std::move(e).value(); - } - - // is_copy_constructible_v<E> is true and is_constructible_v<E, decltype(std::move(error()))> is false. - { - const std::expected<int, CopyConstructibleButNotMoveConstructible> e; - [[maybe_unused]] auto val = std::move(e).value(); - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be both copy constructible and constructible from decltype(std::move(error()))}} - } - } -// These diagnostics happen when we try to construct bad_expected_access from the non copy-constructible error type. -#if _LIBCPP_HAS_EXCEPTIONS - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} -#endif -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.expected/value_or.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.expected/value_or.mandates.verify.cpp deleted file mode 100644 index 5d26f36..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.expected/value_or.mandates.verify.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error - -// Test the mandates -// template<class U> constexpr T value_or(U&& v) const &; -// Mandates: is_copy_constructible_v<T> is true and is_convertible_v<U, T> is true. - -// template<class U> constexpr T value_or(U&& v) &&; -// Mandates: is_move_constructible_v<T> is true and is_convertible_v<U, T> is true. - -#include <expected> -#include <utility> - -struct NonCopyable { - NonCopyable(int) {} - NonCopyable(const NonCopyable&) = delete; -}; - -struct NonMovable { - NonMovable(int) {} - NonMovable(NonMovable&&) = delete; -}; - -struct NotConvertibleFromInt {}; - -void test() { - // const & overload - // !is_copy_constructible_v<T>, - { - const std::expected<NonCopyable, int> f1{5}; - f1.value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NonCopyable, int>::value_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}value_type has to be copy constructible}} - } - - // const & overload - // !is_convertible_v<U, T> - { - const std::expected<NotConvertibleFromInt, int> f1{std::in_place}; - f1.value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NotConvertibleFromInt, int>::value_or<int>' requested here}} - //expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to value_type}} - } - - // && overload - // !is_move_constructible_v<T>, - { - std::expected<NonMovable, int> f1{5}; - std::move(f1).value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NonMovable, int>::value_or<int>' requested here}} - //expected-error-re@*:* {{static assertion failed {{.*}}value_type has to be move constructible}} - } - - // && overload - // !is_convertible_v<U, T> - { - std::expected<NotConvertibleFromInt, int> f1{std::in_place}; - std::move(f1).value_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<NotConvertibleFromInt, int>::value_or<int>' requested here}} - //expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to value_type}} - } -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/class.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/class.mandates.verify.cpp deleted file mode 100644 index f859ce0..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/class.mandates.verify.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// A program that instantiates the definition of unexpected for a non-object type, an array type, a specialization of unexpected, or a cv-qualified type is ill-formed. - -#include <expected> - - - -template class std::unexpected<int[2]>; // expected-error-re@*:* {{static assertion failed {{.*}}[expected.un.general]}} - -template class std::unexpected<const int>; // expected-error-re@*:* {{static assertion failed {{.*}}[expected.un.general]}} - -template class std::unexpected<int&>; // expected-error-re@*:* {{static assertion failed {{.*}}[expected.un.general]}} - -template class std::unexpected<std::unexpected<int>>; // expected-error-re@*:* {{static assertion failed {{.*}}[expected.un.general]}} - -template class std::unexpected<volatile int>; // expected-error-re@*:* {{static assertion failed {{.*}}[expected.un.general]}} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/noexcept.extension.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/noexcept.extension.compile.pass.cpp deleted file mode 100644 index 162ecd5..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/noexcept.extension.compile.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// test libc++ noexcept extensions on operations of std::unexpected<E> - -#include <expected> -#include <type_traits> -#include <utility> - -#include "../types.h" - -// unexpected(Error&&); -static_assert(std::is_nothrow_constructible_v< // - std::unexpected<int>, - const int&>); -static_assert(!std::is_nothrow_constructible_v< // - std::unexpected<ConvertFromCopyIntMayThrow>, - const int&>); - - -// unexpected(in_place_t, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::unexpected<int>, - std::in_place_t, - const int&>); -static_assert(!std::is_nothrow_constructible_v< // - std::unexpected<ConvertFromCopyIntMayThrow>, - std::in_place_t, - const int&>); - -// unexpected(in_place_t, initializer_list<U>, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::unexpected<ConvertFromInitializerListNoexcept>, - std::in_place_t, - std::initializer_list<int>>); -static_assert(!std::is_nothrow_constructible_v< // - std::unexpected<ConvertFromInitializerListMayThrow>, - std::in_place_t, - std::initializer_list<int>>); diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/swap.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/swap.mandates.verify.cpp deleted file mode 100644 index f87dff2..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.unexpected/swap.mandates.verify.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error - -// Test the mandates -// constexpr void swap(unexpected& other) noexcept(is_nothrow_swappable_v<E>); -// Mandates: is_swappable_v<E> is true. - -#include <expected> - -struct Foo {}; - -void swap(Foo&, Foo&) = delete; - -void test() { - std::unexpected<Foo> f1{Foo{}}; - f1.swap(f1); // expected-note{{in instantiation of member function 'std::unexpected<Foo>::swap' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}unexpected::swap requires is_swappable_v<E> to be true}} -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/and_then.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/and_then.mandates.verify.cpp deleted file mode 100644 index e1a7ec5..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/and_then.mandates.verify.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// template<class F> constexpr auto and_then(F&& f) &; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -// template<class F> constexpr auto and_then(F&& f) const &; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -// template<class F> constexpr auto and_then(F&& f) &&; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -// template<class F> constexpr auto and_then(F&& f) const &&; -// Mandates: -// Let U be std::remove_cvref_t<std::invoke_result<F>> -// U is a specialization of std::expected and std::is_same_v<U:error_type, E> is true - -#include <expected> -#include <utility> - -struct NotSameAsInt {}; - -int lval_return_not_std_expected(void) { return 0; } -int clval_return_not_std_expected(void) { return 0; } -int rval_return_not_std_expected(void) { return 0; } -int crval_return_not_std_expected(void) { return 0; } - -std::expected<int, NotSameAsInt> lval_error_type_not_same_as_int(void) { return {}; } -std::expected<int, NotSameAsInt> clval_error_type_not_same_as_int(void) { return {}; } -std::expected<int, NotSameAsInt> rval_error_type_not_same_as_int(void) { return {}; } -std::expected<int, NotSameAsInt> crval_error_type_not_same_as_int(void) { return {}; } - -// clang-format off -void test() { - // Test & overload - { - // U is not a specialization of std::expected - { - std::expected<void, int> f1; - f1.and_then(lval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<int (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - std::expected<void, int> f1; - f1.and_then(lval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<std::expected<int, NotSameAsInt> (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must have the same error_type as this expected}} - } - } - - // Test const& overload - { - // U is not a specialization of std::expected - { - const std::expected<void, int> f1; - f1.and_then(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<int (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - const std::expected<void, int> f1; - f1.and_then(clval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<std::expected<int, NotSameAsInt> (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must have the same error_type as this expected}} - } - } - - // Test && overload - { - // U is not a specialization of std::expected - { - std::expected<void, int> f1; - std::move(f1).and_then(rval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<int (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - std::expected<void, int> f1; - std::move(f1).and_then(rval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<std::expected<int, NotSameAsInt> (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must have the same error_type as this expected}} - } - } - - // Test const&& overload - { - // U is not a specialization of std::expected - { - const std::expected<void, int> f1; - std::move(f1).and_then(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<int (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - // expected-error-re@*:* {{no matching constructor for initialization of{{.*}}}} - } - - // !std::is_same_v<U:error_type, E> - { - const std::expected<void, int> f1; - std::move(f1).and_then(crval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::and_then<std::expected<int, NotSameAsInt> (&)()>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f() must have the same error_type as this expected}} - } - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/assert.deref.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/assert.deref.pass.cpp deleted file mode 100644 index 6f1ba07..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/assert.deref.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// constexpr void operator*() const noexcept; -// -// Preconditions: has_value() is true. - -#include <expected> -#include <utility> - -#include "check_assertion.h" - -int main(int, char**) { - std::expected<void, int> e{std::unexpect, 5}; - TEST_LIBCPP_ASSERT_FAILURE(*e, "expected::operator* requires the expected to contain a value"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/assert.error.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/assert.error.pass.cpp deleted file mode 100644 index a1c92ff..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/assert.error.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -// constexpr const E& error() const & noexcept; -// constexpr E& error() & noexcept; -// constexpr E&& error() && noexcept; -// constexpr const E&& error() const && noexcept; -// -// Preconditions: has_value() is false. - -#include <expected> -#include <utility> - -#include "check_assertion.h" - -int main(int, char**) { - std::expected<void, int> e{std::in_place}; - TEST_LIBCPP_ASSERT_FAILURE(e.error(), "expected::error requires the expected to contain an error"); - TEST_LIBCPP_ASSERT_FAILURE(std::as_const(e).error(), "expected::error requires the expected to contain an error"); - TEST_LIBCPP_ASSERT_FAILURE(std::move(e).error(), "expected::error requires the expected to contain an error"); - TEST_LIBCPP_ASSERT_FAILURE(std::move(std::as_const(e)).error(), "expected::error requires the expected to contain an error"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/error_or.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/error_or.mandates.verify.cpp deleted file mode 100644 index 21f93b8..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/error_or.mandates.verify.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// template<class G = E> constexpr E error_or(G&&) const &; -// Mandates: is_copy_constructible_v<G> is true and is_convertible_v<U, E> is true. - -// template<class G = E> constexpr E error_or(G&&) &&; -// Mandates: is_move_constructible_v<G> is true and is_convertible_v<U, E> is true. - -#include <expected> -#include <utility> - -struct NonCopyable { - NonCopyable(int) {} - NonCopyable(const NonCopyable&) = delete; -}; - -struct NonMovable { - NonMovable(int) {} - NonMovable(NonMovable&&) = delete; -}; - -struct NotConvertibleFromInt {}; - -// clang-format off -void test() { - // const & overload - // !is_copy_constructible_v<G>, - { - const std::expected<void, NonCopyable> f1(std::unexpect, 0); - f1.error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<void, NonCopyable>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be copy constructible}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - } - - // const & overload - // !is_convertible_v<U, T> - { - const std::expected<void, NotConvertibleFromInt> f1(std::unexpect, NotConvertibleFromInt{}); - f1.error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<void, NotConvertibleFromInt>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to error_type}} - // expected-error-re@*:* {{no viable conversion from returned value of type{{.*}}}} - } - - // && overload - // !is_move_constructible_v<T>, - { - std::expected<void, NonMovable> f1(std::unexpect, 0); - std::move(f1).error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<void, NonMovable>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}error_type has to be move constructible}} - // expected-error-re@*:* {{call to deleted constructor of{{.*}}}} - } - - // && overload - // !is_convertible_v<U, T> - { - std::expected<void, NotConvertibleFromInt> f1(std::unexpect, NotConvertibleFromInt{}); - std::move(f1).error_or(5); // expected-note{{in instantiation of function template specialization 'std::expected<void, NotConvertibleFromInt>::error_or<int>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}argument has to be convertible to error_type}} - // expected-error-re@*:* {{no viable conversion from returned value of type{{.*}}}} - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/no_unique_address.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/no_unique_address.compile.pass.cpp deleted file mode 100644 index c4aae33..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/no_unique_address.compile.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// clang-cl and cl currently don't support [[no_unique_address]] -// XFAIL: msvc - -// test [[no_unique_address]] is applied to the union -// In particular, we ensure that we reuse tail padding in the T -// to store the discriminator whenever we can. - -#include <__type_traits/datasizeof.h> -#include <expected> -#include <optional> -#include <memory> - -struct Empty {}; - -struct A { - int x_; - int y_; -}; - -struct B : public A { - int z_; - short z2_; - virtual ~B() = default; -}; - -struct BoolWithPadding { - explicit operator bool() { return b; } - -private: - alignas(1024) bool b = false; -}; - -static_assert(sizeof(std::expected<void, Empty>) == sizeof(bool)); -static_assert(sizeof(std::expected<void, A>) == 2 * sizeof(int) + alignof(std::expected<void, A>)); -static_assert(sizeof(std::expected<void, B>) == sizeof(B)); - -// Check that `expected`'s datasize is large enough for the parameter type(s). -static_assert(sizeof(std::expected<void, BoolWithPadding>) == - std::__datasizeof_v<std::expected<void, BoolWithPadding>>); - -// In this case, there should be tail padding in the `expected` because `A` -// itself does _not_ have tail padding. -static_assert(sizeof(std::expected<void, A>) > std::__datasizeof_v<std::expected<void, A>>); - -// Test with some real types. -static_assert(sizeof(std::expected<void, std::optional<int>>) == 8); -static_assert(std::__datasizeof_v<std::expected<void, std::optional<int>>> == 8); - -static_assert(sizeof(std::expected<void, int>) == 8); -static_assert(std::__datasizeof_v<std::expected<void, int>> == 5); - -// clang-format off -static_assert(std::__datasizeof_v<int> == 4); -static_assert(std::__datasizeof_v<std::expected<void, int>> == 5); -static_assert(std::__datasizeof_v<std::expected<void, std::expected<void, int>>> == 8); -static_assert(std::__datasizeof_v<std::expected<void, std::expected<void, std::expected<void, int>>>> == 9); -static_assert(std::__datasizeof_v<std::expected<void, std::expected<void, std::expected<void, std::expected<void, int>>>>> == 12); -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/noexcept.extension.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/noexcept.extension.compile.pass.cpp deleted file mode 100644 index 2d5cee9..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/noexcept.extension.compile.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// test libc++ noexcept extensions on operations of std::expected<void, E> - -#include <expected> -#include <type_traits> -#include <utility> - -#include "../types.h" - -// expected(const expected&) -static_assert(std::is_nothrow_copy_constructible_v<std::expected<void, int>>); -static_assert(!std::is_nothrow_copy_constructible_v<std::expected<void, CopyMayThrow>>); - - -// expected(const expected<OtherT, OtherE>&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<void, long>, - const std::expected<void, int>&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromCopyIntMayThrow>, - const std::expected<void, int>&>); - - -// expected(expected<OtherT, OtherE>&&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<void, long>, - std::expected<void, int>&&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromMoveIntMayThrow>, - std::expected<void, int>&&>); - -// expected(const unexpected<OtherE>&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<void, long>, - const std::unexpected<int>&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromCopyIntMayThrow>, - const std::unexpected<int>&>); - -// expected(unexpected<OtherE>&&) -static_assert(std::is_nothrow_constructible_v< // - std::expected<void, long>, - std::unexpected<int>&&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromMoveIntMayThrow>, - std::unexpected<int>&&>); - - -// expected(unexpect_t, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::expected<void, int>, - std::unexpect_t, - const int&>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromCopyIntMayThrow>, - std::unexpect_t, - const int&>); - -// expected(unexpect_t, initializer_list<U>, _Args&&...); -static_assert(std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromInitializerListNoexcept>, - std::unexpect_t, - std::initializer_list<int>>); -static_assert(!std::is_nothrow_constructible_v< // - std::expected<void, ConvertFromInitializerListMayThrow>, - std::unexpect_t, - std::initializer_list<int>>); - -// expected& operator=(const expected&) -static_assert(std::is_nothrow_copy_assignable_v<std::expected<void, int>>); -static_assert(!std::is_nothrow_copy_assignable_v<std::expected<void, CopyConstructMayThrow>>); -static_assert(!std::is_nothrow_copy_assignable_v<std::expected<void, CopyAssignMayThrow>>); diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/or_else.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/or_else.mandates.verify.cpp deleted file mode 100644 index 3046d09..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/or_else.mandates.verify.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// Test the mandates -// template<class F> constexpr auto or_else(F&& f) &; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -// template<class F> constexpr auto or_else(F&& f) const &; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -// template<class F> constexpr auto or_else(F&& f) &&; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -// template<class F> constexpr auto or_else(F&& f) const &&; -// Mandates: -// Let G be std::remove_cvref_t<std::invoke_result<F, decltype(error())>> -// G is a specialization of std::expected and std::is_same_v<G:value_type, T> is true - -#include <expected> -#include <utility> - -struct NotSameAsInt {}; - -int lval_return_not_std_expected(int&) { return 0; } -int clval_return_not_std_expected(const int&) { return 0; } -int rval_return_not_std_expected(int&&) { return 0; } -int crval_return_not_std_expected(const int&&) { return 0; } - -std::expected<NotSameAsInt, int> lval_error_type_not_same_as_int(int&) { return {}; } -std::expected<NotSameAsInt, int> clval_error_type_not_same_as_int(const int&) { return {}; } -std::expected<NotSameAsInt, int> rval_error_type_not_same_as_int(int&&) { return {}; } -std::expected<NotSameAsInt, int> crval_error_type_not_same_as_int(const int&&) { return {}; } - -// clang-format off -void test() { - // Test & overload - { - // G is not a specialization of std::expected - { - std::expected<void, int> f1(std::unexpected<int>(1)); - f1.or_else(lval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<int (&)(int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - } - - // !std::is_same_v<G:value_type, T> - { - std::expected<void, int> f1(std::unexpected<int>(1)); - f1.or_else(lval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<std::expected<NotSameAsInt, int> (&)(int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must have the same value_type as this expected}} - } - } - - // Test const& overload - { - // G is not a specialization of std::expected - { - const std::expected<void, int> f1(std::unexpected<int>(1)); - f1.or_else(clval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<int (&)(const int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - } - - // !std::is_same_v<G:value_type, T> - { - const std::expected<void, int> f1(std::unexpected<int>(1)); - f1.or_else(clval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<std::expected<NotSameAsInt, int> (&)(const int &)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(error()) must have the same value_type as this expected}} - } - } - - // Test && overload - { - // G is not a specialization of std::expected - { - std::expected<void, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(rval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<int (&)(int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - } - - // !std::is_same_v<G:value_type, T> - { - std::expected<void, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(rval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<std::expected<NotSameAsInt, int> (&)(int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must have the same value_type as this expected}} - } - } - - // Test const&& overload - { - // G is not a specialization of std::expected - { - const std::expected<void, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(crval_return_not_std_expected); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<int (&)(const int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must be a specialization of std::expected}} - // expected-error-re@*:* {{{{.*}}cannot be used prior to '::' because it has no members}} - } - - // !std::is_same_v<G:value_type, T> - { - const std::expected<void, int> f1(std::unexpected<int>(1)); - std::move(f1).or_else(crval_error_type_not_same_as_int); // expected-note{{in instantiation of function template specialization 'std::expected<void, int>::or_else<std::expected<NotSameAsInt, int> (&)(const int &&)>' requested here}} - // expected-error-re@*:* {{static assertion failed {{.*}}The result of f(std::move(error())) must have the same value_type as this expected}} - } - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/transform_error.mandates.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/transform_error.mandates.verify.cpp deleted file mode 100644 index 16233cd..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/transform_error.mandates.verify.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Clang-18 fixed some spurious clang diagnostics. Once clang-18 is the -// minumum required version these obsolete tests can be removed. -// TODO(LLVM-20) remove spurious clang diagnostic tests. - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix -// which break the tests. But #102851 will turn it into an error, making the test pass. -// However, upstream libcxx buildbots do not build clang from source while testing, so -// this tests still expected to fail on these bots. -// -// TODO(LLVM 22): Remove '0-1' from 'expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}' -// and remove 'expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}' -// and remove 'expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}}' -// once LLVM 22 releases. See See https://github.com/llvm/llvm-project/issues/104885. - -// Test the mandates - -// template<class F> constexpr auto transform_error(F&& f) &; -// template<class F> constexpr auto transform_error(F&& f) const &; -// -// Let G be remove_cv_t<invoke_result_t<F, decltype(error())>> -// G is a valid template argument for unexpected ([expected.un.general]) and the declaration -// G g(invoke(std::forward<F>(f), error())); is well-formed. - -// template<class F> constexpr auto transform_error(F&& f) &&; -// template<class F> constexpr auto transform_error(F&& f) const &&; -// -// Let G be remove_cv_t<invoke_result_t<F, decltype(std::move(error()))>>. -// G is a valid template argument for unexpected ([expected.un.general]) and the declaration -// G g(invoke(std::forward<F>(f), std::move(error()))); is well-formed. - -#include <expected> -#include <utility> - -static int val; - -template <class T> -std::unexpected<int> return_unexpected(T) { - return std::unexpected<int>(1); -} - -template <class T> -int& return_no_object(T) { - return val; -} - -// clang-format off -void test() { - - // Test & overload - { - std::expected<void, int> e; - e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - // expected-error-re@*:* {{static assertion failed {{.*}}A program that instantiates expected<T, E> with a E that is not a valid argument for unexpected<E> is ill-formed}} - // expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}} - // expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}} - - e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - // expected-error-re@*:* {{static assertion failed {{.*}}A program that instantiates expected<T, E> with a E that is not a valid argument for unexpected<E> is ill-formed}} - // expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}} - } - - // Test const& overload - { - const std::expected<void, int> e; - e.transform_error(return_unexpected<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - e.transform_error(return_no_object<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - // expected-error-re@*:* 0-1 {{call to deleted constructor of {{.*}}}} - } - - // Test && overload - { - std::expected<void, int> e; - std::move(e).transform_error(return_unexpected<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - std::move(e).transform_error(return_no_object<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - } - - // Test const&& overload - { - const std::expected<void, int> e; - std::move(e).transform_error(return_unexpected<const int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - std::move(e).transform_error(return_no_object<const int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}} - // expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}} - } -} -// clang-format on diff --git a/libcxx/test/libcxx-03/utilities/expected/expected.void/value.lwg3940.verify.cpp b/libcxx/test/libcxx-03/utilities/expected/expected.void/value.lwg3940.verify.cpp deleted file mode 100644 index 253ef1d..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/expected.void/value.lwg3940.verify.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: no-rtti -// UNSUPPORTED: no-exceptions - -// constexpr void value() const &; -// Mandates: is_copy_constructible_v<E> is true. - -// constexpr void value() &&; -// Mandates: is_copy_constructible_v<E> is true and is_move_constructible_v<E> is true. - -#include <expected> - -#include "MoveOnly.h" - -struct CopyOnly { - CopyOnly() = default; - CopyOnly(const CopyOnly&) = default; - CopyOnly(CopyOnly&&) = delete; -}; - -void test() { - // MoveOnly type as error_type - std::expected<void, MoveOnly> e(std::unexpect, 5); - - e.value(); // expected-note {{in instantiation of member function 'std::expected<void, MoveOnly>::value' requested here}} - // expected-error@*:* {{static assertion failed due to requirement 'is_copy_constructible_v<MoveOnly>'}} - // expected-error@*:* {{call to deleted constructor of 'MoveOnly'}} - - std::move(e) - .value(); // expected-note {{in instantiation of member function 'std::expected<void, MoveOnly>::value' requested here}} - // expected-error@*:* {{static assertion failed due to requirement 'is_copy_constructible_v<MoveOnly>'}} - - // CopyOnly type as error_type - std::expected<void, CopyOnly> e2(std::unexpect); - // expected-error@*:* {{call to deleted constructor of 'CopyOnly'}} - - e2.value(); - - std::move(e2) - .value(); // expected-note {{in instantiation of member function 'std::expected<void, CopyOnly>::value' requested here}} - // expected-error@*:* {{static assertion failed due to requirement 'is_move_constructible_v<CopyOnly>'}} - // expected-error@*:* {{call to deleted constructor of 'CopyOnly'}} -} diff --git a/libcxx/test/libcxx-03/utilities/expected/types.h b/libcxx/test/libcxx-03/utilities/expected/types.h deleted file mode 100644 index 52b4e6e..0000000 --- a/libcxx/test/libcxx-03/utilities/expected/types.h +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef TEST_LIBCXX_UTILITIES_EXPECTED_TYPES_H -#define TEST_LIBCXX_UTILITIES_EXPECTED_TYPES_H - -#include <initializer_list> - -struct DefaultMayThrow { - DefaultMayThrow(); -}; - -struct CopyMayThrow { - CopyMayThrow(const CopyMayThrow&); -}; - -struct ConvertFromCopyIntMayThrow { - ConvertFromCopyIntMayThrow(const int&); - ConvertFromCopyIntMayThrow(int&&) noexcept; -}; - -struct ConvertFromMoveIntMayThrow { - ConvertFromMoveIntMayThrow(const int&) noexcept; - ConvertFromMoveIntMayThrow(int&&); -}; - -struct ConvertFromInitializerListNoexcept { - ConvertFromInitializerListNoexcept(std::initializer_list<int>) noexcept; -}; - -struct ConvertFromInitializerListMayThrow { - ConvertFromInitializerListMayThrow(std::initializer_list<int>); -}; - -struct CopyConstructMayThrow { - CopyConstructMayThrow(const CopyConstructMayThrow&); - CopyConstructMayThrow& operator=(CopyConstructMayThrow const&) noexcept; -}; - -struct CopyAssignMayThrow { - CopyAssignMayThrow(const CopyAssignMayThrow&) noexcept; - CopyAssignMayThrow& operator=(CopyAssignMayThrow const&); -}; - - -#endif // TEST_LIBCXX_UTILITIES_EXPECTED_TYPES_H diff --git a/libcxx/test/libcxx-03/utilities/expol/policies.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/expol/policies.compile.pass.cpp deleted file mode 100644 index 8217b94..0000000 --- a/libcxx/test/libcxx-03/utilities/expol/policies.compile.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Make sure we don't allow copying the execution policies in any way to avoid users relying on it. - -// UNSUPPORTED: c++03, c++11, c++14 - -// UNSUPPORTED: libcpp-has-no-incomplete-pstl - -#include <execution> -#include <type_traits> - -#include "test_macros.h" - -static_assert(!std::is_default_constructible_v<std::execution::sequenced_policy>); -static_assert(!std::is_copy_constructible_v<std::execution::sequenced_policy>); -static_assert(!std::is_move_constructible_v<std::execution::sequenced_policy>); -static_assert(!std::is_copy_assignable_v<std::execution::sequenced_policy>); -static_assert(!std::is_move_assignable_v<std::execution::sequenced_policy>); - -static_assert(!std::is_default_constructible_v<std::execution::parallel_policy>); -static_assert(!std::is_copy_constructible_v<std::execution::parallel_policy>); -static_assert(!std::is_move_constructible_v<std::execution::parallel_policy>); -static_assert(!std::is_copy_assignable_v<std::execution::parallel_policy>); -static_assert(!std::is_move_assignable_v<std::execution::parallel_policy>); - -static_assert(!std::is_default_constructible_v<std::execution::parallel_unsequenced_policy>); -static_assert(!std::is_copy_constructible_v<std::execution::parallel_unsequenced_policy>); -static_assert(!std::is_move_constructible_v<std::execution::parallel_unsequenced_policy>); -static_assert(!std::is_copy_assignable_v<std::execution::parallel_unsequenced_policy>); -static_assert(!std::is_move_assignable_v<std::execution::parallel_unsequenced_policy>); - -#if TEST_STD_VER >= 20 -static_assert(!std::is_default_constructible_v<std::execution::unsequenced_policy>); -static_assert(!std::is_copy_constructible_v<std::execution::unsequenced_policy>); -static_assert(!std::is_move_constructible_v<std::execution::unsequenced_policy>); -static_assert(!std::is_copy_assignable_v<std::execution::unsequenced_policy>); -static_assert(!std::is_move_assignable_v<std::execution::unsequenced_policy>); -#endif diff --git a/libcxx/test/libcxx-03/utilities/format/enable_insertable.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/format/enable_insertable.compile.pass.cpp deleted file mode 100644 index 064d7cf..0000000 --- a/libcxx/test/libcxx-03/utilities/format/enable_insertable.compile.pass.cpp +++ /dev/null @@ -1,151 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <format> - -#include <format> -#include <array> -#include <deque> -#include <forward_list> -#include <list> -#include <map> -#include <queue> -#include <set> -#include <span> -#include <stack> -#include <string> -#include <string_view> - -#include "test_macros.h" - -template <class CharT> -struct no_value_type { - using iterator = CharT*; - iterator end(); - void insert(iterator, CharT*, CharT*); -}; - -template <class CharT> -struct no_end { - using value_type = CharT; - using iterator = CharT*; - void insert(iterator, CharT*, CharT*); -}; - -template <class CharT> -struct no_insert { - using value_type = CharT; - using iterator = CharT*; - iterator end(); -}; - -template <class CharT> -struct no_specialization { - using value_type = CharT; - using iterator = CharT*; - iterator end(); - void insert(iterator, CharT*, CharT*); -}; - -template <class CharT> -struct valid { - using value_type = CharT; - using iterator = CharT*; - iterator end(); - void insert(iterator, CharT*, CharT*); -}; - -template <> -inline constexpr bool std::__format::__enable_insertable<no_value_type<char>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<no_end<char>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<no_insert<char>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<valid<char>> = true; -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -template <> -inline constexpr bool std::__format::__enable_insertable<no_value_type<wchar_t>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<no_end<wchar_t>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<no_insert<wchar_t>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<valid<wchar_t>> = true; -#endif - -static_assert(!std::__format::__insertable<no_value_type<char>>); -static_assert(!std::__format::__insertable<no_end<char>>); -static_assert(!std::__format::__insertable<no_insert<char>>); -static_assert(!std::__format::__insertable<no_specialization<char>>); -static_assert(std::__format::__insertable<valid<char>>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__format::__insertable<no_value_type<wchar_t>>); -static_assert(!std::__format::__insertable<no_end<wchar_t>>); -static_assert(!std::__format::__insertable<no_insert<wchar_t>>); -static_assert(!std::__format::__insertable<no_specialization<wchar_t>>); -static_assert(std::__format::__insertable<valid<wchar_t>>); -#endif - -template <> -inline constexpr bool std::__format::__enable_insertable<valid<signed char>> = true; -template <> -inline constexpr bool std::__format::__enable_insertable<valid<unsigned char>> = true; - -static_assert(!std::__format::__insertable<valid<signed char>>); -static_assert(!std::__format::__insertable<valid<unsigned char>>); - -static_assert(std::__format::__insertable<std::string>); -static_assert(!std::__format::__insertable<std::string_view>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(std::__format::__insertable<std::wstring>); -static_assert(!std::__format::__insertable<std::wstring_view>); -#endif - -static_assert(!std::__format::__insertable<std::array<char, 1>>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__format::__insertable<std::array<wchar_t, 1>>); -#endif - -static_assert(std::__format::__insertable<std::vector<char>>); -static_assert(std::__format::__insertable<std::deque<char>>); -static_assert(!std::__format::__insertable<std::forward_list<char>>); -static_assert(std::__format::__insertable<std::list<char>>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(std::__format::__insertable<std::vector<wchar_t>>); -static_assert(std::__format::__insertable<std::deque<wchar_t>>); -static_assert(!std::__format::__insertable<std::forward_list<wchar_t>>); -static_assert(std::__format::__insertable<std::list<wchar_t>>); -#endif - -static_assert(!std::__format::__insertable<std::set<char>>); -static_assert(!std::__format::__insertable<std::map<char, char>>); -static_assert(!std::__format::__insertable<std::multiset<char>>); -static_assert(!std::__format::__insertable<std::multimap<char, char>>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__format::__insertable<std::set<wchar_t>>); -static_assert(!std::__format::__insertable<std::map<wchar_t, wchar_t>>); -static_assert(!std::__format::__insertable<std::multiset<wchar_t>>); -static_assert(!std::__format::__insertable<std::multimap<wchar_t, wchar_t>>); -#endif - -static_assert(!std::__format::__insertable<std::stack<char>>); -static_assert(!std::__format::__insertable<std::queue<char>>); -static_assert(!std::__format::__insertable<std::priority_queue<char>>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__format::__insertable<std::stack<wchar_t>>); -static_assert(!std::__format::__insertable<std::queue<wchar_t>>); -static_assert(!std::__format::__insertable<std::priority_queue<wchar_t>>); -#endif - -static_assert(!std::__format::__insertable<std::span<char>>); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(!std::__format::__insertable<std::span<wchar_t>>); -#endif diff --git a/libcxx/test/libcxx-03/utilities/format/format.arguments/format.arg/arg_t.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.arguments/format.arg/arg_t.compile.pass.cpp deleted file mode 100644 index 8ecca81..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.arguments/format.arg/arg_t.compile.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <format> - -// namespace __format { enum class __arg_t : uint8_t{...}; } - -#include <format> - -#include <cstdint> -#include <type_traits> - -#include "test_macros.h" - -static_assert(std::is_same_v<std::underlying_type_t<std::__format::__arg_t>, std::uint8_t>); - -static_assert(std::uint8_t(std::__format::__arg_t::__none) == 0); -static_assert(std::uint8_t(std::__format::__arg_t::__boolean) == 1); -static_assert(std::uint8_t(std::__format::__arg_t::__char_type) == 2); -static_assert(std::uint8_t(std::__format::__arg_t::__int) == 3); -static_assert(std::uint8_t(std::__format::__arg_t::__long_long) == 4); -static_assert(std::uint8_t(std::__format::__arg_t::__i128) == 5); -static_assert(std::uint8_t(std::__format::__arg_t::__unsigned) == 6); -static_assert(std::uint8_t(std::__format::__arg_t::__unsigned_long_long) == 7); -static_assert(std::uint8_t(std::__format::__arg_t::__u128) == 8); -static_assert(std::uint8_t(std::__format::__arg_t::__float) == 9); -static_assert(std::uint8_t(std::__format::__arg_t::__double) == 10); -static_assert(std::uint8_t(std::__format::__arg_t::__long_double) == 11); -static_assert(std::uint8_t(std::__format::__arg_t::__const_char_type_ptr) == 12); -static_assert(std::uint8_t(std::__format::__arg_t::__string_view) == 13); -static_assert(std::uint8_t(std::__format::__arg_t::__ptr) == 14); -static_assert(std::uint8_t(std::__format::__arg_t::__handle) == 15); diff --git a/libcxx/test/libcxx-03/utilities/format/format.arguments/format.arg/assert.array.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.arguments/format.arg/assert.array.pass.cpp deleted file mode 100644 index 1e9b1d9..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.arguments/format.arg/assert.array.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <format> - -// Formatting non-null-terminated character arrays. - -// REQUIRES: std-at-least-c++20, has-unix-headers, libcpp-hardening-mode={{extensive|debug}} -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <format> - -#include "check_assertion.h" - -int main(int, char**) { - { - const char non_null_terminated[3]{'1', '2', '3'}; - TEST_LIBCPP_ASSERT_FAILURE(std::format("{}", non_null_terminated), "formatting a non-null-terminated array"); - } -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - { - const wchar_t non_null_terminated[3]{L'1', L'2', L'3'}; - TEST_LIBCPP_ASSERT_FAILURE(std::format(L"{}", non_null_terminated), "formatting a non-null-terminated array"); - } -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/format/format.formatter/format.context/types.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.formatter/format.context/types.compile.pass.cpp deleted file mode 100644 index cd06c50..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.formatter/format.context/types.compile.pass.cpp +++ /dev/null @@ -1,128 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <format> - -// Class typedefs: -// template<class Out, class charT> -// class basic_format_context { -// public: -// using iterator = Out -// using char_type = charT; -// template<class T> using formatter_type = formatter<T, charT>; -// } -// -// Namespace std typedefs: -// using format_context = basic_format_context<unspecified, char>; -// using wformat_context = basic_format_context<unspecified, wchar_t>; - -#include <format> -#include <iterator> -#include <string_view> -#include <type_traits> - -#include "test_macros.h" - -template <class OutIt, class CharT> -constexpr void test() { - static_assert( - std::is_same_v<typename std::basic_format_context<OutIt, CharT>::iterator, - OutIt>); - static_assert( - std::is_same_v< - typename std::basic_format_context<OutIt, CharT>::char_type, CharT>); - static_assert(std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<bool>, - std::formatter<bool, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<CharT>, - std::formatter<CharT, CharT>>); - static_assert(std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<int>, - std::formatter<int, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<unsigned>, - std::formatter<unsigned, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<long long>, - std::formatter<long long, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context<OutIt, CharT>:: - template formatter_type<unsigned long long>, - std::formatter<unsigned long long, CharT>>); -#ifndef TEST_HAS_NO_INT128 - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<__int128_t>, - std::formatter<__int128_t, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<__uint128_t>, - std::formatter<__uint128_t, CharT>>); -#endif - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<float>, - std::formatter<float, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<double>, - std::formatter<double, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<long double>, - std::formatter<long double, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<const CharT*>, - std::formatter<const CharT*, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context<OutIt, CharT>:: - template formatter_type<std::basic_string_view<CharT>>, - std::formatter<std::basic_string_view<CharT>, CharT>>); - static_assert( - std::is_same_v<typename std::basic_format_context< - OutIt, CharT>::template formatter_type<const void*>, - std::formatter<const void*, CharT>>); -} - -constexpr void test() { - test<std::back_insert_iterator<std::__format::__output_buffer<char>>, char>(); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - test<std::back_insert_iterator<std::__format::__output_buffer<wchar_t>>, - wchar_t>(); -#endif -} - -template <class, class> -constexpr bool is_basic_format_context_specialization = false; -template <class It, class CharT> -constexpr bool is_basic_format_context_specialization<std::basic_format_context<It, CharT>, CharT> = true; - -static_assert(is_basic_format_context_specialization<std::format_context, char>); -static_assert( - std::is_same_v< - std::format_context, - std::basic_format_context< - std::back_insert_iterator<std::__format::__output_buffer<char>>, - char>>); - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -static_assert(is_basic_format_context_specialization<std::wformat_context, wchar_t>); -LIBCPP_STATIC_ASSERT( - std::is_same_v< - std::wformat_context, - std::basic_format_context< - std::back_insert_iterator< std::__format::__output_buffer<wchar_t>>, - wchar_t>>); -#endif diff --git a/libcxx/test/libcxx-03/utilities/format/format.functions/ascii.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.functions/ascii.pass.cpp deleted file mode 100644 index 818fc72..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.functions/ascii.pass.cpp +++ /dev/null @@ -1,161 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// REQUIRES: libcpp-has-no-unicode - -// TODO FMT This test should not require std::to_chars(floating-point) -// XFAIL: availability-fp_to_chars-missing - -// <format> - -// Tests Unicode is ignored and handled as ASCII. - -#include <format> -#include <cassert> -#include <vector> - -#include "test_macros.h" - -// Note the comment annotations are from the Unicode test -static void test_char() { - //*** 1-byte code points *** - assert(std::format("{:*^3}", " ") == "* *"); - assert(std::format("{:*^3}", "~") == "*~*"); - - //*** 2-byte code points *** - assert(std::format("{:*^4}", "\u00a1") == "*\u00a1*"); // INVERTED EXCLAMATION MARK - assert(std::format("{:*^4}", "\u07ff") == "*\u07ff*"); // NKO TAMAN SIGN - - //*** 3-byte code points *** - assert(std::format("{:*^5}", "\u0800") == "*\u0800*"); // SAMARITAN LETTER ALAF - assert(std::format("{:*^5}", "\ufffd") == "*\ufffd*"); // REPLACEMENT CHARACTER - - // 2 column ranges - assert(std::format("{:*^5}", "\u1100") == "*\u1100*"); // HANGUL CHOSEONG KIYEOK - assert(std::format("{:*^5}", "\u115f") == "*\u115f*"); // HANGUL CHOSEONG FILLER - - assert(std::format("{:*^5}", "\u2329") == "*\u2329*"); // LEFT-POINTING ANGLE BRACKET - assert(std::format("{:*^5}", "\u232a") == "*\u232a*"); // RIGHT-POINTING ANGLE BRACKET - - assert(std::format("{:*^5}", "\u2e80") == "*\u2e80*"); // CJK RADICAL REPEAT - assert(std::format("{:*^5}", "\u303e") == "*\u303e*"); // IDEOGRAPHIC VARIATION INDICATOR - - assert(std::format("{:*^5}", "\u3040") == "*\u3040*"); // U+3041 HIRAGANA LETTER SMALL A - assert(std::format("{:*^5}", "\ua4cf") == "*\ua4cf*"); // U+A4D0 LISU LETTER BA - - assert(std::format("{:*^5}", "\uac00") == "*\uac00*"); // <Hangul Syllable, First> - assert(std::format("{:*^5}", "\ud7a3") == "*\ud7a3*"); // Hangul Syllable Hih - - assert(std::format("{:*^5}", "\uf900") == "*\uf900*"); // CJK COMPATIBILITY IDEOGRAPH-F900 - assert(std::format("{:*^5}", "\ufaff") == "*\ufaff*"); // U+FB00 LATIN SMALL LIGATURE FF - - assert(std::format("{:*^5}", "\ufe10") == "*\ufe10*"); // PRESENTATION FORM FOR VERTICAL COMMA - assert(std::format("{:*^5}", "\ufe19") == "*\ufe19*"); // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS - - assert(std::format("{:*^5}", "\ufe30") == "*\ufe30*"); // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER - assert(std::format("{:*^5}", "\ufe6f") == "*\ufe6f*"); // U+FE70 ARABIC FATHATAN ISOLATED FORM - - assert(std::format("{:*^5}", "\uff00") == "*\uff00*"); // U+FF01 FULLWIDTH EXCLAMATION MARK - assert(std::format("{:*^5}", "\uff60") == "*\uff60*"); // FULLWIDTH RIGHT WHITE PARENTHESIS - - assert(std::format("{:*^5}", "\uffe0") == "*\uffe0*"); // FULLWIDTH CENT SIGN - assert(std::format("{:*^5}", "\uffe6") == "*\uffe6*"); // FULLWIDTH WON SIGN - - //*** 4-byte code points *** - assert(std::format("{:*^6}", "\U00010000") == "*\U00010000*"); // LINEAR B SYLLABLE B008 A - assert(std::format("{:*^6}", "\U0010FFFF") == "*\U0010FFFF*"); // Undefined Character - - // 2 column ranges - assert(std::format("{:*^6}", "\U0001f300") == "*\U0001f300*"); // CYCLONE - assert(std::format("{:*^6}", "\U0001f64f") == "*\U0001f64f*"); // PERSON WITH FOLDED HANDS - assert(std::format("{:*^6}", "\U0001f900") == "*\U0001f900*"); // CIRCLED CROSS FORMEE WITH FOUR DOTS - assert(std::format("{:*^6}", "\U0001f9ff") == "*\U0001f9ff*"); // NAZAR AMULET - assert(std::format("{:*^6}", "\U00020000") == "*\U00020000*"); // <CJK Ideograph Extension B, First> - assert(std::format("{:*^6}", "\U0002fffd") == "*\U0002fffd*"); // Undefined Character - assert(std::format("{:*^6}", "\U00030000") == "*\U00030000*"); // <CJK Ideograph Extension G, First> - assert(std::format("{:*^6}", "\U0003fffd") == "*\U0003fffd*"); // Undefined Character -} - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -// Note the comment annotations are from the Unicode test -static void test_wchar_t() { - if constexpr (sizeof(wchar_t) == 2) { - // TODO FMT Add these tests. - } else { - //*** 1-byte code points *** - assert(std::format(L"{:*^3}", L" ") == L"* *"); - assert(std::format(L"{:*^3}", L"~") == L"*~*"); - - //*** 2-byte code points *** - assert(std::format(L"{:*^3}", L"\u00a1") == L"*\u00a1*"); // INVERTED EXCLAMATION MARK - assert(std::format(L"{:*^3}", L"\u07ff") == L"*\u07ff*"); // NKO TAMAN SIGN - - //*** 3-byte code points *** - assert(std::format(L"{:*^3}", L"\u0800") == L"*\u0800*"); // SAMARITAN LETTER ALAF - assert(std::format(L"{:*^3}", L"\ufffd") == L"*\ufffd*"); // REPLACEMENT CHARACTER - - // 2 column ranges - assert(std::format(L"{:*^3}", L"\u1100") == L"*\u1100*"); // HANGUL CHOSEONG KIYEOK - assert(std::format(L"{:*^3}", L"\u115f") == L"*\u115f*"); // HANGUL CHOSEONG FILLER - - assert(std::format(L"{:*^3}", L"\u2329") == L"*\u2329*"); // LEFT-POINTING ANGLE BRACKET - assert(std::format(L"{:*^3}", L"\u232a") == L"*\u232a*"); // RIGHT-POINTING ANGLE BRACKET - - assert(std::format(L"{:*^3}", L"\u2e80") == L"*\u2e80*"); // CJK RADICAL REPEAT - assert(std::format(L"{:*^3}", L"\u303e") == L"*\u303e*"); // IDEOGRAPHIC VARIATION INDICATOR - - assert(std::format(L"{:*^3}", L"\u3040") == L"*\u3040*"); // U+3041 HIRAGANA LETTER SMALL A - assert(std::format(L"{:*^3}", L"\ua4cf") == L"*\ua4cf*"); // U+A4D0 LISU LETTER BA - - assert(std::format(L"{:*^3}", L"\uac00") == L"*\uac00*"); // <Hangul Syllable, First> - assert(std::format(L"{:*^3}", L"\ud7a3") == L"*\ud7a3*"); // Hangul Syllable Hih - - assert(std::format(L"{:*^3}", L"\uf900") == L"*\uf900*"); // CJK COMPATIBILITY IDEOGRAPH-F900 - assert(std::format(L"{:*^3}", L"\ufaff") == L"*\ufaff*"); // U+FB00 LATIN SMALL LIGATURE FF - - assert(std::format(L"{:*^3}", L"\ufe10") == L"*\ufe10*"); // PRESENTATION FORM FOR VERTICAL COMMA - assert(std::format(L"{:*^3}", L"\ufe19") == L"*\ufe19*"); // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS - - assert(std::format(L"{:*^3}", L"\ufe30") == L"*\ufe30*"); // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER - assert(std::format(L"{:*^3}", L"\ufe6f") == L"*\ufe6f*"); // U+FE70 ARABIC FATHATAN ISOLATED FORM - - assert(std::format(L"{:*^3}", L"\uff00") == L"*\uff00*"); // U+FF01 FULLWIDTH EXCLAMATION MARK - assert(std::format(L"{:*^3}", L"\uff60") == L"*\uff60*"); // FULLWIDTH RIGHT WHITE PARENTHESIS - - assert(std::format(L"{:*^3}", L"\uffe0") == L"*\uffe0*"); // FULLWIDTH CENT SIGN - assert(std::format(L"{:*^3}", L"\uffe6") == L"*\uffe6*"); // FULLWIDTH WON SIGN - - //*** 4-byte code points *** - assert(std::format(L"{:*^3}", L"\U00010000") == L"*\U00010000*"); // LINEAR B SYLLABLE B008 A - assert(std::format(L"{:*^3}", L"\U0010FFFF") == L"*\U0010FFFF*"); // Undefined Character - - // 2 column ranges - assert(std::format(L"{:*^3}", L"\U0001f300") == L"*\U0001f300*"); // CYCLONE - assert(std::format(L"{:*^3}", L"\U0001f64f") == L"*\U0001f64f*"); // PERSON WITH FOLDED HANDS - assert(std::format(L"{:*^3}", L"\U0001f900") == L"*\U0001f900*"); // CIRCLED CROSS FORMEE WITH FOUR DOTS - assert(std::format(L"{:*^3}", L"\U0001f9ff") == L"*\U0001f9ff*"); // NAZAR AMULET - assert(std::format(L"{:*^3}", L"\U00020000") == L"*\U00020000*"); // <CJK Ideograph Extension B, First> - assert(std::format(L"{:*^3}", L"\U0002fffd") == L"*\U0002fffd*"); // Undefined Character - assert(std::format(L"{:*^3}", L"\U00030000") == L"*\U00030000*"); // <CJK Ideograph Extension G, First> - assert(std::format(L"{:*^3}", L"\U0003fffd") == L"*\U0003fffd*"); // Undefined Character - } -} -#endif - -int main(int, char**) { - test_char(); - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - test_wchar_t(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/format/format.functions/escaped_output.ascii.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.functions/escaped_output.ascii.pass.cpp deleted file mode 100644 index 7d1cce5..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.functions/escaped_output.ascii.pass.cpp +++ /dev/null @@ -1,352 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// TODO FMT This test should not require std::to_chars(floating-point) -// XFAIL: availability-fp_to_chars-missing - -// REQUIRES: libcpp-has-no-unicode - -// <format> - -// This test the debug string type for the formatter specializations for char -// and string types. This tests ASCII strings, the tests assume every char32_t value is valid ASCII. - -#include <cassert> -#include <concepts> -#include <iterator> -#include <list> -#include <vector> - -#include "test_macros.h" -#include "make_string.h" -#include "test_format_string.h" -#include "assert_macros.h" -#include "concat_macros.h" - -#ifndef TEST_HAS_NO_LOCALIZATION -# include <iostream> -#endif - -#define SV(S) MAKE_STRING_VIEW(CharT, S) - -auto test_format = []<class CharT, class... Args>( - std::basic_string_view<CharT> expected, test_format_string<CharT, Args...> fmt, Args&&... args) { - { - std::basic_string<CharT> out = std::format(fmt, std::forward<Args>(args)...); - TEST_REQUIRE(out == expected, - TEST_WRITE_CONCATENATED( - "\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n')); - } -#ifndef TEST_HAS_NO_LOCALIZATION - { - std::basic_string<CharT> out = std::format(std::locale(), fmt, std::forward<Args>(args)...); - assert(out == expected); - } -#endif // TEST_HAS_NO_LOCALIZATION -}; - -auto test_format_to = - []<class CharT, class... Args>( - std::basic_string_view<CharT> expected, test_format_string<CharT, Args...> fmt, Args&&... args) { - { - std::basic_string<CharT> out(expected.size(), CharT(' ')); - auto it = std::format_to(out.begin(), fmt, std::forward<Args>(args)...); - assert(it == out.end()); - assert(out == expected); - } -#ifndef TEST_HAS_NO_LOCALIZATION - { - std::basic_string<CharT> out(expected.size(), CharT(' ')); - auto it = std::format_to(out.begin(), std::locale(), fmt, std::forward<Args>(args)...); - assert(it == out.end()); - assert(out == expected); - } -#endif // TEST_HAS_NO_LOCALIZATION - { - std::list<CharT> out; - std::format_to(std::back_inserter(out), fmt, std::forward<Args>(args)...); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); - } - { - std::vector<CharT> out; - std::format_to(std::back_inserter(out), fmt, std::forward<Args>(args)...); - assert(std::equal(out.begin(), out.end(), expected.begin(), expected.end())); - } - { - assert(expected.size() < 4096 && "Update the size of the buffer."); - CharT out[4096]; - CharT* it = std::format_to(out, fmt, std::forward<Args>(args)...); - assert(std::distance(out, it) == int(expected.size())); - // Convert to std::string since output contains '\0' for boolean tests. - assert(std::basic_string<CharT>(out, it) == expected); - } - }; - -auto test_formatted_size = - []<class CharT, class... Args>( - std::basic_string_view<CharT> expected, test_format_string<CharT, Args...> fmt, Args&&... args) { - { - std::size_t size = std::formatted_size(fmt, std::forward<Args>(args)...); - assert(size == expected.size()); - } -#ifndef TEST_HAS_NO_LOCALIZATION - { - std::size_t size = std::formatted_size(std::locale(), fmt, std::forward<Args>(args)...); - assert(size == expected.size()); - } -#endif // TEST_HAS_NO_LOCALIZATION - }; - -auto test_format_to_n = - []<class CharT, class... Args>( - std::basic_string_view<CharT> expected, test_format_string<CharT, Args...> fmt, Args&&... args) { - { - std::size_t n = expected.size(); - std::basic_string<CharT> out(n, CharT(' ')); - std::format_to_n_result result = std::format_to_n(out.begin(), n, fmt, std::forward<Args>(args)...); - assert(result.size == static_cast<std::ptrdiff_t>(expected.size())); - assert(result.out == out.end()); - assert(out == expected); - } -#ifndef TEST_HAS_NO_LOCALIZATION - { - std::size_t n = expected.size(); - std::basic_string<CharT> out(n, CharT(' ')); - std::format_to_n_result result = - std::format_to_n(out.begin(), n, std::locale(), fmt, std::forward<Args>(args)...); - assert(result.size == static_cast<std::ptrdiff_t>(expected.size())); - assert(result.out == out.end()); - assert(out == expected); - } -#endif // TEST_HAS_NO_LOCALIZATION - { - std::ptrdiff_t n = 0; - std::basic_string<CharT> out; - std::format_to_n_result result = std::format_to_n(out.begin(), n, fmt, std::forward<Args>(args)...); - assert(result.size == static_cast<std::ptrdiff_t>(expected.size())); - assert(result.out == out.end()); - assert(out.empty()); - } - { - std::ptrdiff_t n = expected.size() / 2; - std::basic_string<CharT> out(n, CharT(' ')); - std::format_to_n_result result = std::format_to_n(out.begin(), n, fmt, std::forward<Args>(args)...); - assert(result.size == static_cast<std::ptrdiff_t>(expected.size())); - assert(result.out == out.end()); - assert(out == expected.substr(0, n)); - } - }; - -template <class CharT> -void test_char() { - // *** P2286 examples *** - test_format(SV("['\\'', '\"']"), SV("[{:?}, {:?}]"), CharT('\''), CharT('"')); - - // *** Special cases *** - test_format(SV("'\\t'"), SV("{:?}"), CharT('\t')); - test_format(SV("'\\n'"), SV("{:?}"), CharT('\n')); - test_format(SV("'\\r'"), SV("{:?}"), CharT('\r')); - test_format(SV("'\\\\'"), SV("{:?}"), CharT('\\')); - - test_format(SV("'\\\''"), SV("{:?}"), CharT('\'')); - test_format(SV("'\"'"), SV("{:?}"), CharT('"')); // only special for string - - test_format(SV("' '"), SV("{:?}"), CharT(' ')); - - // *** Printable *** - test_format(SV("'a'"), SV("{:?}"), CharT('a')); - test_format(SV("'b'"), SV("{:?}"), CharT('b')); - test_format(SV("'c'"), SV("{:?}"), CharT('c')); - - // *** Non-printable *** - - // Control - test_format(SV("'\\u{0}'"), SV("{:?}"), CharT('\0')); - test_format(SV("'\\u{1f}'"), SV("{:?}"), CharT('\x1f')); - - // Ill-formed - if constexpr (sizeof(CharT) == 1) - test_format(SV("'\x80'"), SV("{:?}"), CharT('\x80')); - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - if constexpr (sizeof(CharT) > 1) { - using V = std::basic_string_view<CharT>; - - // Unicode fitting in a 16-bit wchar_t - - // *** Non-printable *** - - // Space_Separator - test_format(V{L"'\xa0'"}, L"{:?}", L'\xa0'); // NO-BREAK SPACE - test_format(V{L"'\x3000'"}, L"{:?}", L'\x3000'); // IDEOGRAPHIC SPACE - - // Line_Separator - test_format(V{L"'\x2028'"}, L"{:?}", L'\x2028'); // LINE SEPARATOR - - // Paragraph_Separator - test_format(V{L"'\x2029'"}, L"{:?}", L'\x2029'); // PARAGRAPH SEPARATOR - - // Format - test_format(V{L"'\xad'"}, L"{:?}", L'\xad'); // SOFT HYPHEN - test_format(V{L"'\x600'"}, L"{:?}", L'\x600'); // ARABIC NUMBER SIGN - test_format(V{L"'\xfeff'"}, L"{:?}", L'\xfeff'); // ZERO WIDTH NO-BREAK SPACE - - if constexpr (sizeof(CharT) == 2) { - // Incomplete surrogate pair in UTF-16 - test_format(V{L"'\xd800'"}, L"{:?}", L'\xd800'); // <surrogate-D800> - test_format(V{L"'\xdfff'"}, L"{:?}", L'\xdfff'); // <surrogate-DFFF> - } else { - test_format(V{L"'\xd800'"}, L"{:?}", L'\xd800'); // <surrogate-D800> - test_format(V{L"'\xdfff'"}, L"{:?}", L'\xdfff'); // <surrogate-DFFF> - } - - // Private_Use - test_format(V{L"'\xe000'"}, L"{:?}", L'\xe000'); // <private-use-E000> - test_format(V{L"'\xf8ff'"}, L"{:?}", L'\xf8ff'); // <private-use-F8FF> - - // Unassigned - test_format(V{L"'\x378'"}, L"{:?}", L'\x378'); // <reserved-0378> - test_format(V{L"'\x1774'"}, L"{:?}", L'\x1774'); // <reserved-1774> - test_format(V{L"'\xffff'"}, L"{:?}", L'\xffff'); // <noncharacter-FFFF> - - // Grapheme Extended - test_format(V{L"'\x300'"}, L"{:?}", L'\x300'); // COMBINING GRAVE ACCENT - test_format(V{L"'\xfe20'"}, L"{:?}", L'\xfe20'); // VARIATION SELECTOR-1 - } -# ifndef TEST_SHORT_WCHAR - if constexpr (sizeof(CharT) > 2) { - static_assert(sizeof(CharT) == 4, "add support for unexpected size"); - // Unicode fitting in a 32-bit wchar_t - - constexpr wchar_t x = 0x1ffff; - constexpr std::uint32_t y = 0x1ffff; - static_assert(x == y); - - using V = std::basic_string_view<CharT>; - - // *** Non-printable *** - // Format - test_format(V{L"'\x110bd'"}, L"{:?}", L'\x110bd'); // KAITHI NUMBER SIGN - test_format(V{L"'\xe007f'"}, L"{:?}", L'\xe007f'); // CANCEL TAG - - // Private_Use - test_format(V{L"'\xf0000'"}, L"{:?}", L'\xf0000'); // <private-use-F0000> - test_format(V{L"'\xffffd'"}, L"{:?}", L'\xffffd'); // <private-use-FFFFD> - - test_format(V{L"'\x100000'"}, L"{:?}", L'\x100000'); // <private-use-100000> - test_format(V{L"'\x10fffd'"}, L"{:?}", L'\x10fffd'); // <private-use-10FFFD> - - // Unassigned - test_format(V{L"'\x1000c'"}, L"{:?}", L'\x1000c'); // <reserved-1000c> - test_format(V{L"'\xfffff'"}, L"{:?}", L'\xfffff'); // <noncharacter-FFFFF> - test_format(V{L"'\x10fffe'"}, L"{:?}", L'\x10fffe'); // <noncharacter-10FFFE> - - // Grapheme Extended - test_format(V{L"'\x101fd'"}, L"{:?}", L'\x101fd'); // COMBINING OLD PERMIC LETTER AN - test_format(V{L"'\xe0100'"}, L"{:?}", L'\xe0100'); // VARIATION SELECTOR-17 - - // Ill-formed - test_format(V{L"'\x110000'"}, L"{:?}", L'\x110000'); - test_format(V{L"'\xffffffff'"}, L"{:?}", L'\xffffffff'); - } -# endif // TEST_SHORT_WCHAR -#endif // TEST_HAS_NO_WIDE_CHARACTERS -} - -template <class CharT> -void test_string() { - // *** P2286 examples *** - test_format(SV("[h\tllo]"), SV("[{}]"), SV("h\tllo")); - test_format(SV(R"(["h\tllo"])"), SV("[{:?}]"), SV("h\tllo")); - test_format(SV(R"(["Спасибо, Виктор ♥!"])"), SV("[{:?}]"), SV("Спасибо, Виктор ♥!")); - - test_format(SV(R"(["\u{0} \n \t \u{2} \u{1b}"])"), SV("[{:?}]"), SV("\0 \n \t \x02 \x1b")); - - if constexpr (sizeof(CharT) == 1) { - // Ill-formend UTF-8, but valid as ASCII - test_format(SV("[\"\xc3\"]"), SV("[{:?}]"), SV("\xc3")); - test_format(SV("[\"\xc3\x28\"]"), SV("[{:?}]"), SV("\xc3\x28")); - } else { - // Valid UTF-16 and UTF-32 - test_format(SV("[\"\u00c3\"]"), SV("[{:?}]"), L"\xc3"); // LATIN CAPITAL LETTER A WITH TILDE - test_format(SV("[\"\u00c3(\"]"), SV("[{:?}]"), L"\xc3\x28"); - } - - test_format(SV("[\"🤷🏻\u200d♂\ufe0f\"]"), SV("[{:?}]"), SV("🤷🏻♂️")); - - // *** Special cases *** - test_format(SV(R"("\t\n\r\\'\" ")"), SV("{:?}"), SV("\t\n\r\\'\" ")); - - // *** Printable *** - test_format(SV(R"("abcdefg")"), SV("{:?}"), SV("abcdefg")); - - // *** Non-printable *** - - // Control - test_format(SV(R"("\u{0}\u{1f}")"), SV("{:?}"), SV("\0\x1f")); - - // Ill-formed UTF-8, valid ASCII - test_format(SV("\"\x80\""), SV("{:?}"), SV("\x80")); -} - -template <class CharT, class TestFunction> -void test_format_functions(TestFunction check) { - // LATIN SMALL LETTER O WITH DIAERESIS is encoded in two chars or 1 wchar_t - // due to the range of the value. - // 8 + sizeof(CharT) == 1 is not considered an constant expression - - // *** align-fill & width *** - check(SV(R"(***"hellö")"), - SV("{:*>{}?}"), - SV("hellö"), - sizeof(CharT) == 1 ? 11 : 10); // ö is LATIN SMALL LETTER O WITH DIAERESIS - check(SV(R"(*"hellö"**)"), SV("{:*^{}?}"), SV("hellö"), sizeof(CharT) == 1 ? 11 : 10); - check(SV(R"("hellö"***)"), SV("{:*<{}?}"), SV("hellö"), sizeof(CharT) == 1 ? 11 : 10); - - check(SV("\"hello\u0308\""), SV("{:*>{}?}"), SV("hello\u0308"), sizeof(CharT) == 1 ? 9 : 8); - check(SV("***\"hello\u0308\""), SV("{:*>{}?}"), SV("hello\u0308"), sizeof(CharT) == 1 ? 12 : 11); - check(SV("*\"hello\u0308\"**"), SV("{:*^{}?}"), SV("hello\u0308"), sizeof(CharT) == 1 ? 12 : 11); - check(SV("\"hello\u0308\"***"), SV("{:*<{}?}"), SV("hello\u0308"), sizeof(CharT) == 1 ? 12 : 11); - - // *** width *** - check(SV(R"("hello" )"), SV("{:10?}"), SV("hello")); - - // *** precision *** - check(SV(R"("hell)"), SV("{:.5?}"), SV("hello")); - check(SV(R"("hello)"), SV("{:.6?}"), SV("hello")); - check(SV(R"("hello")"), SV("{:.7?}"), SV("hello")); - - // *** width & precision *** - check(SV(R"("hell#########################)"), SV("{:#<30.5?}"), SV("hello")); - check(SV(R"("hello########################)"), SV("{:#<30.6?}"), SV("hello")); - check(SV(R"("hello"#######################)"), SV("{:#<30.7?}"), SV("hello")); -} - -template <class CharT> -void test() { - test_char<CharT>(); - - test_string<CharT>(); - - test_format_functions<CharT>(test_format); - test_format_functions<CharT>(test_format_to); - test_format_functions<CharT>(test_formatted_size); - test_format_functions<CharT>(test_format_to_n); -} - -int main(int, char**) { - test<char>(); -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - test<wchar_t>(); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/code_point_width_estimation.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/code_point_width_estimation.pass.cpp deleted file mode 100644 index e119e42..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/code_point_width_estimation.pass.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// <format> - -// Tests the implementation of the extended grapheme cluster boundaries per -// https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules -// -// The tests are based on the test data provided by Unicode -// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt - -#include <cassert> -#include <format> -#include <functional> -#include <numeric> - -#include "test_macros.h" - -TEST_DIAGNOSTIC_PUSH -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") -#include <__format/width_estimation_table.h> -TEST_DIAGNOSTIC_POP - -// [format.string.std]/12 -// -// - U+4DC0 - U+4DFF (Yijing Hexagram Symbols) -// - U+1F300 - U+1F5FF (Miscellaneous Symbols and Pictographs) -// - U+1F900 - U+1F9FF (Supplemental Symbols and Pictographs) -static void constexpr test_hardcoded_values() { - auto test = [](char32_t c) { assert(std::__width_estimation_table::__estimated_width(c) == 2); }; - for (char32_t c = 0x4DC0; c <= 0x4DFF; ++c) - test(c); - for (char32_t c = 0x1F300; c <= 0x1F5FF; ++c) - test(c); - for (char32_t c = 0x1F900; c <= 0x1F9FF; ++c) - test(c); -} - -static void constexpr test_invalid_values() { - auto test = [](char32_t c) { assert(std::__width_estimation_table::__estimated_width(c) == 1); }; - - // The surrogate range - for (char32_t c = 0xD800; c <= 0xDFFF; ++c) - test(c); - - // The first 256 non valid code points - for (char32_t c = 0x110000; c <= 0x1100FF; ++c) - test(c); -} - -static void constexpr test_optimization_boundaries() { - // Entries after the table have a width of 1. - static_assert(*(std::end(std::__width_estimation_table::__entries) - 1) == ((0x3c000u << 14) | 16381u), - "validate whether the optimizations in __estimated_width are still valid"); - assert(std::__width_estimation_table::__estimated_width(0x3fffd) == 2); - assert(std::__width_estimation_table::__estimated_width(0x3fffe) == 1); - - // Entries before the table have a width of 1. - static_assert(std::__width_estimation_table::__entries[0] >> 14 == 0x1100, - "validate whether the optimizations in __estimated_width are still valid"); - assert(std::__width_estimation_table::__estimated_width(0x10FF) == 1); - assert(std::__width_estimation_table::__estimated_width(0x1100) == 2); -} - -static constexpr bool test() { - test_hardcoded_values(); - test_invalid_values(); - test_optimization_boundaries(); - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/concepts_precision.h b/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/concepts_precision.h deleted file mode 100644 index 80751ea..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/concepts_precision.h +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_CONCEPTS_PRECISION_H -#define LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_CONCEPTS_PRECISION_H - -template <class T> -concept has_precision = requires(T parser) { - parser.__precision; -}; - -template <class T> -concept has_precision_as_arg = requires(T parser) { - parser.__precision_as_arg; -}; - -#endif // LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_CONCEPTS_PRECISION_H diff --git a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/escaped_output.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/escaped_output.pass.cpp deleted file mode 100644 index d24db36..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/escaped_output.pass.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// <format> - -// Tests the properties of the Unicode escaped output table. -// The libc++ algorithm has size and speed optimizations based on the properties -// of Unicode. This means updating the Unicode tables has a likilihood of -// breaking test. This is an assert; it requires validating whether the -// assumptions of the size and speed optimizations are still valid. - -#include <algorithm> -#include <cassert> -#include <format> -#include <functional> -#include <numeric> - -// Contains the entries for [format.string.escaped]/2.2.1.2.1 -// CE is a Unicode encoding and C corresponds to a UCS scalar value whose -// Unicode property General_Category has a value in the groups Separator (Z) -// or Other (C), as described by table 12 of UAX #44 -// -// Separator (Z) consists of General_Category -// - Zs Space_Separator, -// - Zl Line_Separator, -// - Zp Paragraph_Separator. -// -// Other (C) consists of General_Category -// - Cc Control, -// - Cf Format, -// - Cs Surrogate, -// - Co Private_Use, -// - Cn Unassigned. -inline constexpr int Zs = 17; -inline constexpr int Zl = 1; -inline constexpr int Zp = 1; -inline constexpr int Z = Zs + Zl + Zp; - -inline constexpr int Cc = 65; -inline constexpr int Cf = 170; -inline constexpr int Cs = 2'048; -inline constexpr int Co = 137'468; -inline constexpr int Cn = 819'533; -inline constexpr int C = Cc + Cf + Cs + Co + Cn; - -// This is the final part of the Unicode properties table: -// -// 31350..323AF ; Lo # [4192] CJK UNIFIED IDEOGRAPH-31350..CJK UNIFIED IDEOGRAPH-323AF -// 323B0..E0000 ; Cn # [711761] <reserved-323B0>..<reserved-E0000> -// E0001 ; Cf # LANGUAGE TAG -// E0002..E001F ; Cn # [30] <reserved-E0002>..<reserved-E001F> -// E0020..E007F ; Cf # [96] TAG SPACE..CANCEL TAG -// E0080..E00FF ; Cn # [128] <reserved-E0080>..<reserved-E00FF> -// E0100..E01EF ; Mn # [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 -// E01F0..EFFFF ; Cn # [65040] <reserved-E01F0>..<noncharacter-EFFFF> -// F0000..FFFFD ; Co # [65534] <private-use-F0000>..<private-use-FFFFD> -// FFFFE..FFFFF ; Cn # [2] <noncharacter-FFFFE>..<noncharacter-FFFFF> -// 100000..10FFFD; Co # [65534] <private-use-100000>..<private-use-10FFFD> -// 10FFFE..10FFFF; Cn # [2] <noncharacter-10FFFE>..<noncharacter-10FFFF> -// -// It can be observed all entries in the range 323B0..10FFFF are in the -// categories Cf, Co, Cn, except a small range with the property Mn. -// In order to reduce the size of the table only the entires in the range -// [0000, 323B0) are stored in the table. The entries in the range -// [323B0, 10FFFF] use a hand-crafted algorithm. -// -// This means a number of entries are omitted -inline constexpr int excluded = ((0x10FFFF - 0x323B0) + 1) - 240; - -inline constexpr int entries = Z + C - excluded; - -static constexpr int count_entries() { - return std::transform_reduce( - std::begin(std::__escaped_output_table::__entries), - std::end(std::__escaped_output_table::__entries), - 0, - std::plus{}, - [](auto entry) { return 1 + static_cast<int>(entry & 0x3fffu); }); -} -static_assert(count_entries() == entries); - -int main(int, char**) { - for (char32_t c = 0x31350; c <= 0x323AF; ++c) // 31350..323AF ; Lo # [4192] - assert(std::__escaped_output_table::__needs_escape(c) == false); - - for (char32_t c = 0x323B0; c <= 0xE00FF; ++c) // 323B0..E00FF ; C - assert(std::__escaped_output_table::__needs_escape(c) == true); - - for (char32_t c = 0xE0100; c <= 0xE01EF; ++c) // E0100..E01EF ; Mn # [240] - assert(std::__escaped_output_table::__needs_escape(c) == false); - - for (char32_t c = 0xE01F0; c <= 0x10FFFF; ++c) // E01F0..10FFFF; C - assert(std::__escaped_output_table::__needs_escape(c) == true); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h b/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h deleted file mode 100644 index 9664622..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h +++ /dev/null @@ -1,3382 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// WARNING, this entire header is generated by -// utils/generate_extended_grapheme_cluster_test.py -// DO NOT MODIFY! - -// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE -// -// See Terms of Use <https://www.unicode.org/copyright.html> -// for definitions of Unicode Inc.'s Data Files and Software. -// -// NOTICE TO USER: Carefully read the following legal agreement. -// BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S -// DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), -// YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE -// TERMS AND CONDITIONS OF THIS AGREEMENT. -// IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE -// THE DATA FILES OR SOFTWARE. -// -// COPYRIGHT AND PERMISSION NOTICE -// -// Copyright (c) 1991-2022 Unicode, Inc. All rights reserved. -// Distributed under the Terms of Use in https://www.unicode.org/copyright.html. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of the Unicode data files and any associated documentation -// (the "Data Files") or Unicode software and any associated documentation -// (the "Software") to deal in the Data Files or Software -// without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, and/or sell copies of -// the Data Files or Software, and to permit persons to whom the Data Files -// or Software are furnished to do so, provided that either -// (a) this copyright and permission notice appear with all copies -// of the Data Files or Software, or -// (b) this copyright and permission notice appear in associated -// Documentation. -// -// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF -// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT OF THIRD PARTY RIGHTS. -// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS -// NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL -// DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -// PERFORMANCE OF THE DATA FILES OR SOFTWARE. -// -// Except as contained in this notice, the name of a copyright holder -// shall not be used in advertising or otherwise to promote the sale, -// use or other dealings in these Data Files or Software without prior -// written authorization of the copyright holder. - -#ifndef LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_EXTENDED_GRAPHEME_CLUSTER_H -#define LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_EXTENDED_GRAPHEME_CLUSTER_H - -#include <array> -#include <string_view> -#include <vector> - -#include "test_macros.h" - -template <class CharT> -struct data { - /// The input to parse. - std::basic_string_view<CharT> input; - - /// The first code point all extended grapheme clusters in the input. - std::vector<char32_t> code_points; - - /// The offset of the last code units of the extended grapheme clusters in the input. - /// - /// The vector has the same number of entries as \ref code_points. - std::vector<std::size_t> breaks; -}; - -/// The data for UTF-8. -std::array<data<char>, 1093> data_utf8 = {{ - {"\U00000020\U00000020", {32, 32}, {1, 2}}, - {"\U00000020\U00000308\U00000020", {32, 32}, {3, 4}}, - {"\U00000020\U0000000d", {32, 13}, {1, 2}}, - {"\U00000020\U00000308\U0000000d", {32, 13}, {3, 4}}, - {"\U00000020\U0000000a", {32, 10}, {1, 2}}, - {"\U00000020\U00000308\U0000000a", {32, 10}, {3, 4}}, - {"\U00000020\U00000001", {32, 1}, {1, 2}}, - {"\U00000020\U00000308\U00000001", {32, 1}, {3, 4}}, - {"\U00000020\U0000200c", {32}, {4}}, - {"\U00000020\U00000308\U0000200c", {32}, {6}}, - {"\U00000020\U0001f1e6", {32, 127462}, {1, 5}}, - {"\U00000020\U00000308\U0001f1e6", {32, 127462}, {3, 7}}, - {"\U00000020\U00000600", {32, 1536}, {1, 3}}, - {"\U00000020\U00000308\U00000600", {32, 1536}, {3, 5}}, - {"\U00000020\U00000a03", {32}, {4}}, - {"\U00000020\U00000308\U00000a03", {32}, {6}}, - {"\U00000020\U00001100", {32, 4352}, {1, 4}}, - {"\U00000020\U00000308\U00001100", {32, 4352}, {3, 6}}, - {"\U00000020\U00001160", {32, 4448}, {1, 4}}, - {"\U00000020\U00000308\U00001160", {32, 4448}, {3, 6}}, - {"\U00000020\U000011a8", {32, 4520}, {1, 4}}, - {"\U00000020\U00000308\U000011a8", {32, 4520}, {3, 6}}, - {"\U00000020\U0000ac00", {32, 44032}, {1, 4}}, - {"\U00000020\U00000308\U0000ac00", {32, 44032}, {3, 6}}, - {"\U00000020\U0000ac01", {32, 44033}, {1, 4}}, - {"\U00000020\U00000308\U0000ac01", {32, 44033}, {3, 6}}, - {"\U00000020\U00000903", {32}, {4}}, - {"\U00000020\U00000308\U00000903", {32}, {6}}, - {"\U00000020\U00000904", {32, 2308}, {1, 4}}, - {"\U00000020\U00000308\U00000904", {32, 2308}, {3, 6}}, - {"\U00000020\U00000d4e", {32, 3406}, {1, 4}}, - {"\U00000020\U00000308\U00000d4e", {32, 3406}, {3, 6}}, - {"\U00000020\U00000915", {32, 2325}, {1, 4}}, - {"\U00000020\U00000308\U00000915", {32, 2325}, {3, 6}}, - {"\U00000020\U0000231a", {32, 8986}, {1, 4}}, - {"\U00000020\U00000308\U0000231a", {32, 8986}, {3, 6}}, - {"\U00000020\U00000300", {32}, {3}}, - {"\U00000020\U00000308\U00000300", {32}, {5}}, - {"\U00000020\U00000900", {32}, {4}}, - {"\U00000020\U00000308\U00000900", {32}, {6}}, - {"\U00000020\U0000094d", {32}, {4}}, - {"\U00000020\U00000308\U0000094d", {32}, {6}}, - {"\U00000020\U0000200d", {32}, {4}}, - {"\U00000020\U00000308\U0000200d", {32}, {6}}, - {"\U00000020\U00000378", {32, 888}, {1, 3}}, - {"\U00000020\U00000308\U00000378", {32, 888}, {3, 5}}, - {"\U0000000d\U00000020", {13, 32}, {1, 2}}, - {"\U0000000d\U00000308\U00000020", {13, 776, 32}, {1, 3, 4}}, - {"\U0000000d\U0000000d", {13, 13}, {1, 2}}, - {"\U0000000d\U00000308\U0000000d", {13, 776, 13}, {1, 3, 4}}, - {"\U0000000d\U0000000a", {13}, {2}}, - {"\U0000000d\U00000308\U0000000a", {13, 776, 10}, {1, 3, 4}}, - {"\U0000000d\U00000001", {13, 1}, {1, 2}}, - {"\U0000000d\U00000308\U00000001", {13, 776, 1}, {1, 3, 4}}, - {"\U0000000d\U0000200c", {13, 8204}, {1, 4}}, - {"\U0000000d\U00000308\U0000200c", {13, 776}, {1, 6}}, - {"\U0000000d\U0001f1e6", {13, 127462}, {1, 5}}, - {"\U0000000d\U00000308\U0001f1e6", {13, 776, 127462}, {1, 3, 7}}, - {"\U0000000d\U00000600", {13, 1536}, {1, 3}}, - {"\U0000000d\U00000308\U00000600", {13, 776, 1536}, {1, 3, 5}}, - {"\U0000000d\U00000a03", {13, 2563}, {1, 4}}, - {"\U0000000d\U00000308\U00000a03", {13, 776}, {1, 6}}, - {"\U0000000d\U00001100", {13, 4352}, {1, 4}}, - {"\U0000000d\U00000308\U00001100", {13, 776, 4352}, {1, 3, 6}}, - {"\U0000000d\U00001160", {13, 4448}, {1, 4}}, - {"\U0000000d\U00000308\U00001160", {13, 776, 4448}, {1, 3, 6}}, - {"\U0000000d\U000011a8", {13, 4520}, {1, 4}}, - {"\U0000000d\U00000308\U000011a8", {13, 776, 4520}, {1, 3, 6}}, - {"\U0000000d\U0000ac00", {13, 44032}, {1, 4}}, - {"\U0000000d\U00000308\U0000ac00", {13, 776, 44032}, {1, 3, 6}}, - {"\U0000000d\U0000ac01", {13, 44033}, {1, 4}}, - {"\U0000000d\U00000308\U0000ac01", {13, 776, 44033}, {1, 3, 6}}, - {"\U0000000d\U00000903", {13, 2307}, {1, 4}}, - {"\U0000000d\U00000308\U00000903", {13, 776}, {1, 6}}, - {"\U0000000d\U00000904", {13, 2308}, {1, 4}}, - {"\U0000000d\U00000308\U00000904", {13, 776, 2308}, {1, 3, 6}}, - {"\U0000000d\U00000d4e", {13, 3406}, {1, 4}}, - {"\U0000000d\U00000308\U00000d4e", {13, 776, 3406}, {1, 3, 6}}, - {"\U0000000d\U00000915", {13, 2325}, {1, 4}}, - {"\U0000000d\U00000308\U00000915", {13, 776, 2325}, {1, 3, 6}}, - {"\U0000000d\U0000231a", {13, 8986}, {1, 4}}, - {"\U0000000d\U00000308\U0000231a", {13, 776, 8986}, {1, 3, 6}}, - {"\U0000000d\U00000300", {13, 768}, {1, 3}}, - {"\U0000000d\U00000308\U00000300", {13, 776}, {1, 5}}, - {"\U0000000d\U00000900", {13, 2304}, {1, 4}}, - {"\U0000000d\U00000308\U00000900", {13, 776}, {1, 6}}, - {"\U0000000d\U0000094d", {13, 2381}, {1, 4}}, - {"\U0000000d\U00000308\U0000094d", {13, 776}, {1, 6}}, - {"\U0000000d\U0000200d", {13, 8205}, {1, 4}}, - {"\U0000000d\U00000308\U0000200d", {13, 776}, {1, 6}}, - {"\U0000000d\U00000378", {13, 888}, {1, 3}}, - {"\U0000000d\U00000308\U00000378", {13, 776, 888}, {1, 3, 5}}, - {"\U0000000a\U00000020", {10, 32}, {1, 2}}, - {"\U0000000a\U00000308\U00000020", {10, 776, 32}, {1, 3, 4}}, - {"\U0000000a\U0000000d", {10, 13}, {1, 2}}, - {"\U0000000a\U00000308\U0000000d", {10, 776, 13}, {1, 3, 4}}, - {"\U0000000a\U0000000a", {10, 10}, {1, 2}}, - {"\U0000000a\U00000308\U0000000a", {10, 776, 10}, {1, 3, 4}}, - {"\U0000000a\U00000001", {10, 1}, {1, 2}}, - {"\U0000000a\U00000308\U00000001", {10, 776, 1}, {1, 3, 4}}, - {"\U0000000a\U0000200c", {10, 8204}, {1, 4}}, - {"\U0000000a\U00000308\U0000200c", {10, 776}, {1, 6}}, - {"\U0000000a\U0001f1e6", {10, 127462}, {1, 5}}, - {"\U0000000a\U00000308\U0001f1e6", {10, 776, 127462}, {1, 3, 7}}, - {"\U0000000a\U00000600", {10, 1536}, {1, 3}}, - {"\U0000000a\U00000308\U00000600", {10, 776, 1536}, {1, 3, 5}}, - {"\U0000000a\U00000a03", {10, 2563}, {1, 4}}, - {"\U0000000a\U00000308\U00000a03", {10, 776}, {1, 6}}, - {"\U0000000a\U00001100", {10, 4352}, {1, 4}}, - {"\U0000000a\U00000308\U00001100", {10, 776, 4352}, {1, 3, 6}}, - {"\U0000000a\U00001160", {10, 4448}, {1, 4}}, - {"\U0000000a\U00000308\U00001160", {10, 776, 4448}, {1, 3, 6}}, - {"\U0000000a\U000011a8", {10, 4520}, {1, 4}}, - {"\U0000000a\U00000308\U000011a8", {10, 776, 4520}, {1, 3, 6}}, - {"\U0000000a\U0000ac00", {10, 44032}, {1, 4}}, - {"\U0000000a\U00000308\U0000ac00", {10, 776, 44032}, {1, 3, 6}}, - {"\U0000000a\U0000ac01", {10, 44033}, {1, 4}}, - {"\U0000000a\U00000308\U0000ac01", {10, 776, 44033}, {1, 3, 6}}, - {"\U0000000a\U00000903", {10, 2307}, {1, 4}}, - {"\U0000000a\U00000308\U00000903", {10, 776}, {1, 6}}, - {"\U0000000a\U00000904", {10, 2308}, {1, 4}}, - {"\U0000000a\U00000308\U00000904", {10, 776, 2308}, {1, 3, 6}}, - {"\U0000000a\U00000d4e", {10, 3406}, {1, 4}}, - {"\U0000000a\U00000308\U00000d4e", {10, 776, 3406}, {1, 3, 6}}, - {"\U0000000a\U00000915", {10, 2325}, {1, 4}}, - {"\U0000000a\U00000308\U00000915", {10, 776, 2325}, {1, 3, 6}}, - {"\U0000000a\U0000231a", {10, 8986}, {1, 4}}, - {"\U0000000a\U00000308\U0000231a", {10, 776, 8986}, {1, 3, 6}}, - {"\U0000000a\U00000300", {10, 768}, {1, 3}}, - {"\U0000000a\U00000308\U00000300", {10, 776}, {1, 5}}, - {"\U0000000a\U00000900", {10, 2304}, {1, 4}}, - {"\U0000000a\U00000308\U00000900", {10, 776}, {1, 6}}, - {"\U0000000a\U0000094d", {10, 2381}, {1, 4}}, - {"\U0000000a\U00000308\U0000094d", {10, 776}, {1, 6}}, - {"\U0000000a\U0000200d", {10, 8205}, {1, 4}}, - {"\U0000000a\U00000308\U0000200d", {10, 776}, {1, 6}}, - {"\U0000000a\U00000378", {10, 888}, {1, 3}}, - {"\U0000000a\U00000308\U00000378", {10, 776, 888}, {1, 3, 5}}, - {"\U00000001\U00000020", {1, 32}, {1, 2}}, - {"\U00000001\U00000308\U00000020", {1, 776, 32}, {1, 3, 4}}, - {"\U00000001\U0000000d", {1, 13}, {1, 2}}, - {"\U00000001\U00000308\U0000000d", {1, 776, 13}, {1, 3, 4}}, - {"\U00000001\U0000000a", {1, 10}, {1, 2}}, - {"\U00000001\U00000308\U0000000a", {1, 776, 10}, {1, 3, 4}}, - {"\U00000001\U00000001", {1, 1}, {1, 2}}, - {"\U00000001\U00000308\U00000001", {1, 776, 1}, {1, 3, 4}}, - {"\U00000001\U0000200c", {1, 8204}, {1, 4}}, - {"\U00000001\U00000308\U0000200c", {1, 776}, {1, 6}}, - {"\U00000001\U0001f1e6", {1, 127462}, {1, 5}}, - {"\U00000001\U00000308\U0001f1e6", {1, 776, 127462}, {1, 3, 7}}, - {"\U00000001\U00000600", {1, 1536}, {1, 3}}, - {"\U00000001\U00000308\U00000600", {1, 776, 1536}, {1, 3, 5}}, - {"\U00000001\U00000a03", {1, 2563}, {1, 4}}, - {"\U00000001\U00000308\U00000a03", {1, 776}, {1, 6}}, - {"\U00000001\U00001100", {1, 4352}, {1, 4}}, - {"\U00000001\U00000308\U00001100", {1, 776, 4352}, {1, 3, 6}}, - {"\U00000001\U00001160", {1, 4448}, {1, 4}}, - {"\U00000001\U00000308\U00001160", {1, 776, 4448}, {1, 3, 6}}, - {"\U00000001\U000011a8", {1, 4520}, {1, 4}}, - {"\U00000001\U00000308\U000011a8", {1, 776, 4520}, {1, 3, 6}}, - {"\U00000001\U0000ac00", {1, 44032}, {1, 4}}, - {"\U00000001\U00000308\U0000ac00", {1, 776, 44032}, {1, 3, 6}}, - {"\U00000001\U0000ac01", {1, 44033}, {1, 4}}, - {"\U00000001\U00000308\U0000ac01", {1, 776, 44033}, {1, 3, 6}}, - {"\U00000001\U00000903", {1, 2307}, {1, 4}}, - {"\U00000001\U00000308\U00000903", {1, 776}, {1, 6}}, - {"\U00000001\U00000904", {1, 2308}, {1, 4}}, - {"\U00000001\U00000308\U00000904", {1, 776, 2308}, {1, 3, 6}}, - {"\U00000001\U00000d4e", {1, 3406}, {1, 4}}, - {"\U00000001\U00000308\U00000d4e", {1, 776, 3406}, {1, 3, 6}}, - {"\U00000001\U00000915", {1, 2325}, {1, 4}}, - {"\U00000001\U00000308\U00000915", {1, 776, 2325}, {1, 3, 6}}, - {"\U00000001\U0000231a", {1, 8986}, {1, 4}}, - {"\U00000001\U00000308\U0000231a", {1, 776, 8986}, {1, 3, 6}}, - {"\U00000001\U00000300", {1, 768}, {1, 3}}, - {"\U00000001\U00000308\U00000300", {1, 776}, {1, 5}}, - {"\U00000001\U00000900", {1, 2304}, {1, 4}}, - {"\U00000001\U00000308\U00000900", {1, 776}, {1, 6}}, - {"\U00000001\U0000094d", {1, 2381}, {1, 4}}, - {"\U00000001\U00000308\U0000094d", {1, 776}, {1, 6}}, - {"\U00000001\U0000200d", {1, 8205}, {1, 4}}, - {"\U00000001\U00000308\U0000200d", {1, 776}, {1, 6}}, - {"\U00000001\U00000378", {1, 888}, {1, 3}}, - {"\U00000001\U00000308\U00000378", {1, 776, 888}, {1, 3, 5}}, - {"\U0000200c\U00000020", {8204, 32}, {3, 4}}, - {"\U0000200c\U00000308\U00000020", {8204, 32}, {5, 6}}, - {"\U0000200c\U0000000d", {8204, 13}, {3, 4}}, - {"\U0000200c\U00000308\U0000000d", {8204, 13}, {5, 6}}, - {"\U0000200c\U0000000a", {8204, 10}, {3, 4}}, - {"\U0000200c\U00000308\U0000000a", {8204, 10}, {5, 6}}, - {"\U0000200c\U00000001", {8204, 1}, {3, 4}}, - {"\U0000200c\U00000308\U00000001", {8204, 1}, {5, 6}}, - {"\U0000200c\U0000200c", {8204}, {6}}, - {"\U0000200c\U00000308\U0000200c", {8204}, {8}}, - {"\U0000200c\U0001f1e6", {8204, 127462}, {3, 7}}, - {"\U0000200c\U00000308\U0001f1e6", {8204, 127462}, {5, 9}}, - {"\U0000200c\U00000600", {8204, 1536}, {3, 5}}, - {"\U0000200c\U00000308\U00000600", {8204, 1536}, {5, 7}}, - {"\U0000200c\U00000a03", {8204}, {6}}, - {"\U0000200c\U00000308\U00000a03", {8204}, {8}}, - {"\U0000200c\U00001100", {8204, 4352}, {3, 6}}, - {"\U0000200c\U00000308\U00001100", {8204, 4352}, {5, 8}}, - {"\U0000200c\U00001160", {8204, 4448}, {3, 6}}, - {"\U0000200c\U00000308\U00001160", {8204, 4448}, {5, 8}}, - {"\U0000200c\U000011a8", {8204, 4520}, {3, 6}}, - {"\U0000200c\U00000308\U000011a8", {8204, 4520}, {5, 8}}, - {"\U0000200c\U0000ac00", {8204, 44032}, {3, 6}}, - {"\U0000200c\U00000308\U0000ac00", {8204, 44032}, {5, 8}}, - {"\U0000200c\U0000ac01", {8204, 44033}, {3, 6}}, - {"\U0000200c\U00000308\U0000ac01", {8204, 44033}, {5, 8}}, - {"\U0000200c\U00000903", {8204}, {6}}, - {"\U0000200c\U00000308\U00000903", {8204}, {8}}, - {"\U0000200c\U00000904", {8204, 2308}, {3, 6}}, - {"\U0000200c\U00000308\U00000904", {8204, 2308}, {5, 8}}, - {"\U0000200c\U00000d4e", {8204, 3406}, {3, 6}}, - {"\U0000200c\U00000308\U00000d4e", {8204, 3406}, {5, 8}}, - {"\U0000200c\U00000915", {8204, 2325}, {3, 6}}, - {"\U0000200c\U00000308\U00000915", {8204, 2325}, {5, 8}}, - {"\U0000200c\U0000231a", {8204, 8986}, {3, 6}}, - {"\U0000200c\U00000308\U0000231a", {8204, 8986}, {5, 8}}, - {"\U0000200c\U00000300", {8204}, {5}}, - {"\U0000200c\U00000308\U00000300", {8204}, {7}}, - {"\U0000200c\U00000900", {8204}, {6}}, - {"\U0000200c\U00000308\U00000900", {8204}, {8}}, - {"\U0000200c\U0000094d", {8204}, {6}}, - {"\U0000200c\U00000308\U0000094d", {8204}, {8}}, - {"\U0000200c\U0000200d", {8204}, {6}}, - {"\U0000200c\U00000308\U0000200d", {8204}, {8}}, - {"\U0000200c\U00000378", {8204, 888}, {3, 5}}, - {"\U0000200c\U00000308\U00000378", {8204, 888}, {5, 7}}, - {"\U0001f1e6\U00000020", {127462, 32}, {4, 5}}, - {"\U0001f1e6\U00000308\U00000020", {127462, 32}, {6, 7}}, - {"\U0001f1e6\U0000000d", {127462, 13}, {4, 5}}, - {"\U0001f1e6\U00000308\U0000000d", {127462, 13}, {6, 7}}, - {"\U0001f1e6\U0000000a", {127462, 10}, {4, 5}}, - {"\U0001f1e6\U00000308\U0000000a", {127462, 10}, {6, 7}}, - {"\U0001f1e6\U00000001", {127462, 1}, {4, 5}}, - {"\U0001f1e6\U00000308\U00000001", {127462, 1}, {6, 7}}, - {"\U0001f1e6\U0000200c", {127462}, {7}}, - {"\U0001f1e6\U00000308\U0000200c", {127462}, {9}}, - {"\U0001f1e6\U0001f1e6", {127462}, {8}}, - {"\U0001f1e6\U00000308\U0001f1e6", {127462, 127462}, {6, 10}}, - {"\U0001f1e6\U00000600", {127462, 1536}, {4, 6}}, - {"\U0001f1e6\U00000308\U00000600", {127462, 1536}, {6, 8}}, - {"\U0001f1e6\U00000a03", {127462}, {7}}, - {"\U0001f1e6\U00000308\U00000a03", {127462}, {9}}, - {"\U0001f1e6\U00001100", {127462, 4352}, {4, 7}}, - {"\U0001f1e6\U00000308\U00001100", {127462, 4352}, {6, 9}}, - {"\U0001f1e6\U00001160", {127462, 4448}, {4, 7}}, - {"\U0001f1e6\U00000308\U00001160", {127462, 4448}, {6, 9}}, - {"\U0001f1e6\U000011a8", {127462, 4520}, {4, 7}}, - {"\U0001f1e6\U00000308\U000011a8", {127462, 4520}, {6, 9}}, - {"\U0001f1e6\U0000ac00", {127462, 44032}, {4, 7}}, - {"\U0001f1e6\U00000308\U0000ac00", {127462, 44032}, {6, 9}}, - {"\U0001f1e6\U0000ac01", {127462, 44033}, {4, 7}}, - {"\U0001f1e6\U00000308\U0000ac01", {127462, 44033}, {6, 9}}, - {"\U0001f1e6\U00000903", {127462}, {7}}, - {"\U0001f1e6\U00000308\U00000903", {127462}, {9}}, - {"\U0001f1e6\U00000904", {127462, 2308}, {4, 7}}, - {"\U0001f1e6\U00000308\U00000904", {127462, 2308}, {6, 9}}, - {"\U0001f1e6\U00000d4e", {127462, 3406}, {4, 7}}, - {"\U0001f1e6\U00000308\U00000d4e", {127462, 3406}, {6, 9}}, - {"\U0001f1e6\U00000915", {127462, 2325}, {4, 7}}, - {"\U0001f1e6\U00000308\U00000915", {127462, 2325}, {6, 9}}, - {"\U0001f1e6\U0000231a", {127462, 8986}, {4, 7}}, - {"\U0001f1e6\U00000308\U0000231a", {127462, 8986}, {6, 9}}, - {"\U0001f1e6\U00000300", {127462}, {6}}, - {"\U0001f1e6\U00000308\U00000300", {127462}, {8}}, - {"\U0001f1e6\U00000900", {127462}, {7}}, - {"\U0001f1e6\U00000308\U00000900", {127462}, {9}}, - {"\U0001f1e6\U0000094d", {127462}, {7}}, - {"\U0001f1e6\U00000308\U0000094d", {127462}, {9}}, - {"\U0001f1e6\U0000200d", {127462}, {7}}, - {"\U0001f1e6\U00000308\U0000200d", {127462}, {9}}, - {"\U0001f1e6\U00000378", {127462, 888}, {4, 6}}, - {"\U0001f1e6\U00000308\U00000378", {127462, 888}, {6, 8}}, - {"\U00000600\U00000020", {1536}, {3}}, - {"\U00000600\U00000308\U00000020", {1536, 32}, {4, 5}}, - {"\U00000600\U0000000d", {1536, 13}, {2, 3}}, - {"\U00000600\U00000308\U0000000d", {1536, 13}, {4, 5}}, - {"\U00000600\U0000000a", {1536, 10}, {2, 3}}, - {"\U00000600\U00000308\U0000000a", {1536, 10}, {4, 5}}, - {"\U00000600\U00000001", {1536, 1}, {2, 3}}, - {"\U00000600\U00000308\U00000001", {1536, 1}, {4, 5}}, - {"\U00000600\U0000200c", {1536}, {5}}, - {"\U00000600\U00000308\U0000200c", {1536}, {7}}, - {"\U00000600\U0001f1e6", {1536}, {6}}, - {"\U00000600\U00000308\U0001f1e6", {1536, 127462}, {4, 8}}, - {"\U00000600\U00000600", {1536}, {4}}, - {"\U00000600\U00000308\U00000600", {1536, 1536}, {4, 6}}, - {"\U00000600\U00000a03", {1536}, {5}}, - {"\U00000600\U00000308\U00000a03", {1536}, {7}}, - {"\U00000600\U00001100", {1536}, {5}}, - {"\U00000600\U00000308\U00001100", {1536, 4352}, {4, 7}}, - {"\U00000600\U00001160", {1536}, {5}}, - {"\U00000600\U00000308\U00001160", {1536, 4448}, {4, 7}}, - {"\U00000600\U000011a8", {1536}, {5}}, - {"\U00000600\U00000308\U000011a8", {1536, 4520}, {4, 7}}, - {"\U00000600\U0000ac00", {1536}, {5}}, - {"\U00000600\U00000308\U0000ac00", {1536, 44032}, {4, 7}}, - {"\U00000600\U0000ac01", {1536}, {5}}, - {"\U00000600\U00000308\U0000ac01", {1536, 44033}, {4, 7}}, - {"\U00000600\U00000903", {1536}, {5}}, - {"\U00000600\U00000308\U00000903", {1536}, {7}}, - {"\U00000600\U00000904", {1536}, {5}}, - {"\U00000600\U00000308\U00000904", {1536, 2308}, {4, 7}}, - {"\U00000600\U00000d4e", {1536}, {5}}, - {"\U00000600\U00000308\U00000d4e", {1536, 3406}, {4, 7}}, - {"\U00000600\U00000915", {1536}, {5}}, - {"\U00000600\U00000308\U00000915", {1536, 2325}, {4, 7}}, - {"\U00000600\U0000231a", {1536}, {5}}, - {"\U00000600\U00000308\U0000231a", {1536, 8986}, {4, 7}}, - {"\U00000600\U00000300", {1536}, {4}}, - {"\U00000600\U00000308\U00000300", {1536}, {6}}, - {"\U00000600\U00000900", {1536}, {5}}, - {"\U00000600\U00000308\U00000900", {1536}, {7}}, - {"\U00000600\U0000094d", {1536}, {5}}, - {"\U00000600\U00000308\U0000094d", {1536}, {7}}, - {"\U00000600\U0000200d", {1536}, {5}}, - {"\U00000600\U00000308\U0000200d", {1536}, {7}}, - {"\U00000600\U00000378", {1536}, {4}}, - {"\U00000600\U00000308\U00000378", {1536, 888}, {4, 6}}, - {"\U00000a03\U00000020", {2563, 32}, {3, 4}}, - {"\U00000a03\U00000308\U00000020", {2563, 32}, {5, 6}}, - {"\U00000a03\U0000000d", {2563, 13}, {3, 4}}, - {"\U00000a03\U00000308\U0000000d", {2563, 13}, {5, 6}}, - {"\U00000a03\U0000000a", {2563, 10}, {3, 4}}, - {"\U00000a03\U00000308\U0000000a", {2563, 10}, {5, 6}}, - {"\U00000a03\U00000001", {2563, 1}, {3, 4}}, - {"\U00000a03\U00000308\U00000001", {2563, 1}, {5, 6}}, - {"\U00000a03\U0000200c", {2563}, {6}}, - {"\U00000a03\U00000308\U0000200c", {2563}, {8}}, - {"\U00000a03\U0001f1e6", {2563, 127462}, {3, 7}}, - {"\U00000a03\U00000308\U0001f1e6", {2563, 127462}, {5, 9}}, - {"\U00000a03\U00000600", {2563, 1536}, {3, 5}}, - {"\U00000a03\U00000308\U00000600", {2563, 1536}, {5, 7}}, - {"\U00000a03\U00000a03", {2563}, {6}}, - {"\U00000a03\U00000308\U00000a03", {2563}, {8}}, - {"\U00000a03\U00001100", {2563, 4352}, {3, 6}}, - {"\U00000a03\U00000308\U00001100", {2563, 4352}, {5, 8}}, - {"\U00000a03\U00001160", {2563, 4448}, {3, 6}}, - {"\U00000a03\U00000308\U00001160", {2563, 4448}, {5, 8}}, - {"\U00000a03\U000011a8", {2563, 4520}, {3, 6}}, - {"\U00000a03\U00000308\U000011a8", {2563, 4520}, {5, 8}}, - {"\U00000a03\U0000ac00", {2563, 44032}, {3, 6}}, - {"\U00000a03\U00000308\U0000ac00", {2563, 44032}, {5, 8}}, - {"\U00000a03\U0000ac01", {2563, 44033}, {3, 6}}, - {"\U00000a03\U00000308\U0000ac01", {2563, 44033}, {5, 8}}, - {"\U00000a03\U00000903", {2563}, {6}}, - {"\U00000a03\U00000308\U00000903", {2563}, {8}}, - {"\U00000a03\U00000904", {2563, 2308}, {3, 6}}, - {"\U00000a03\U00000308\U00000904", {2563, 2308}, {5, 8}}, - {"\U00000a03\U00000d4e", {2563, 3406}, {3, 6}}, - {"\U00000a03\U00000308\U00000d4e", {2563, 3406}, {5, 8}}, - {"\U00000a03\U00000915", {2563, 2325}, {3, 6}}, - {"\U00000a03\U00000308\U00000915", {2563, 2325}, {5, 8}}, - {"\U00000a03\U0000231a", {2563, 8986}, {3, 6}}, - {"\U00000a03\U00000308\U0000231a", {2563, 8986}, {5, 8}}, - {"\U00000a03\U00000300", {2563}, {5}}, - {"\U00000a03\U00000308\U00000300", {2563}, {7}}, - {"\U00000a03\U00000900", {2563}, {6}}, - {"\U00000a03\U00000308\U00000900", {2563}, {8}}, - {"\U00000a03\U0000094d", {2563}, {6}}, - {"\U00000a03\U00000308\U0000094d", {2563}, {8}}, - {"\U00000a03\U0000200d", {2563}, {6}}, - {"\U00000a03\U00000308\U0000200d", {2563}, {8}}, - {"\U00000a03\U00000378", {2563, 888}, {3, 5}}, - {"\U00000a03\U00000308\U00000378", {2563, 888}, {5, 7}}, - {"\U00001100\U00000020", {4352, 32}, {3, 4}}, - {"\U00001100\U00000308\U00000020", {4352, 32}, {5, 6}}, - {"\U00001100\U0000000d", {4352, 13}, {3, 4}}, - {"\U00001100\U00000308\U0000000d", {4352, 13}, {5, 6}}, - {"\U00001100\U0000000a", {4352, 10}, {3, 4}}, - {"\U00001100\U00000308\U0000000a", {4352, 10}, {5, 6}}, - {"\U00001100\U00000001", {4352, 1}, {3, 4}}, - {"\U00001100\U00000308\U00000001", {4352, 1}, {5, 6}}, - {"\U00001100\U0000200c", {4352}, {6}}, - {"\U00001100\U00000308\U0000200c", {4352}, {8}}, - {"\U00001100\U0001f1e6", {4352, 127462}, {3, 7}}, - {"\U00001100\U00000308\U0001f1e6", {4352, 127462}, {5, 9}}, - {"\U00001100\U00000600", {4352, 1536}, {3, 5}}, - {"\U00001100\U00000308\U00000600", {4352, 1536}, {5, 7}}, - {"\U00001100\U00000a03", {4352}, {6}}, - {"\U00001100\U00000308\U00000a03", {4352}, {8}}, - {"\U00001100\U00001100", {4352}, {6}}, - {"\U00001100\U00000308\U00001100", {4352, 4352}, {5, 8}}, - {"\U00001100\U00001160", {4352}, {6}}, - {"\U00001100\U00000308\U00001160", {4352, 4448}, {5, 8}}, - {"\U00001100\U000011a8", {4352, 4520}, {3, 6}}, - {"\U00001100\U00000308\U000011a8", {4352, 4520}, {5, 8}}, - {"\U00001100\U0000ac00", {4352}, {6}}, - {"\U00001100\U00000308\U0000ac00", {4352, 44032}, {5, 8}}, - {"\U00001100\U0000ac01", {4352}, {6}}, - {"\U00001100\U00000308\U0000ac01", {4352, 44033}, {5, 8}}, - {"\U00001100\U00000903", {4352}, {6}}, - {"\U00001100\U00000308\U00000903", {4352}, {8}}, - {"\U00001100\U00000904", {4352, 2308}, {3, 6}}, - {"\U00001100\U00000308\U00000904", {4352, 2308}, {5, 8}}, - {"\U00001100\U00000d4e", {4352, 3406}, {3, 6}}, - {"\U00001100\U00000308\U00000d4e", {4352, 3406}, {5, 8}}, - {"\U00001100\U00000915", {4352, 2325}, {3, 6}}, - {"\U00001100\U00000308\U00000915", {4352, 2325}, {5, 8}}, - {"\U00001100\U0000231a", {4352, 8986}, {3, 6}}, - {"\U00001100\U00000308\U0000231a", {4352, 8986}, {5, 8}}, - {"\U00001100\U00000300", {4352}, {5}}, - {"\U00001100\U00000308\U00000300", {4352}, {7}}, - {"\U00001100\U00000900", {4352}, {6}}, - {"\U00001100\U00000308\U00000900", {4352}, {8}}, - {"\U00001100\U0000094d", {4352}, {6}}, - {"\U00001100\U00000308\U0000094d", {4352}, {8}}, - {"\U00001100\U0000200d", {4352}, {6}}, - {"\U00001100\U00000308\U0000200d", {4352}, {8}}, - {"\U00001100\U00000378", {4352, 888}, {3, 5}}, - {"\U00001100\U00000308\U00000378", {4352, 888}, {5, 7}}, - {"\U00001160\U00000020", {4448, 32}, {3, 4}}, - {"\U00001160\U00000308\U00000020", {4448, 32}, {5, 6}}, - {"\U00001160\U0000000d", {4448, 13}, {3, 4}}, - {"\U00001160\U00000308\U0000000d", {4448, 13}, {5, 6}}, - {"\U00001160\U0000000a", {4448, 10}, {3, 4}}, - {"\U00001160\U00000308\U0000000a", {4448, 10}, {5, 6}}, - {"\U00001160\U00000001", {4448, 1}, {3, 4}}, - {"\U00001160\U00000308\U00000001", {4448, 1}, {5, 6}}, - {"\U00001160\U0000200c", {4448}, {6}}, - {"\U00001160\U00000308\U0000200c", {4448}, {8}}, - {"\U00001160\U0001f1e6", {4448, 127462}, {3, 7}}, - {"\U00001160\U00000308\U0001f1e6", {4448, 127462}, {5, 9}}, - {"\U00001160\U00000600", {4448, 1536}, {3, 5}}, - {"\U00001160\U00000308\U00000600", {4448, 1536}, {5, 7}}, - {"\U00001160\U00000a03", {4448}, {6}}, - {"\U00001160\U00000308\U00000a03", {4448}, {8}}, - {"\U00001160\U00001100", {4448, 4352}, {3, 6}}, - {"\U00001160\U00000308\U00001100", {4448, 4352}, {5, 8}}, - {"\U00001160\U00001160", {4448}, {6}}, - {"\U00001160\U00000308\U00001160", {4448, 4448}, {5, 8}}, - {"\U00001160\U000011a8", {4448}, {6}}, - {"\U00001160\U00000308\U000011a8", {4448, 4520}, {5, 8}}, - {"\U00001160\U0000ac00", {4448, 44032}, {3, 6}}, - {"\U00001160\U00000308\U0000ac00", {4448, 44032}, {5, 8}}, - {"\U00001160\U0000ac01", {4448, 44033}, {3, 6}}, - {"\U00001160\U00000308\U0000ac01", {4448, 44033}, {5, 8}}, - {"\U00001160\U00000903", {4448}, {6}}, - {"\U00001160\U00000308\U00000903", {4448}, {8}}, - {"\U00001160\U00000904", {4448, 2308}, {3, 6}}, - {"\U00001160\U00000308\U00000904", {4448, 2308}, {5, 8}}, - {"\U00001160\U00000d4e", {4448, 3406}, {3, 6}}, - {"\U00001160\U00000308\U00000d4e", {4448, 3406}, {5, 8}}, - {"\U00001160\U00000915", {4448, 2325}, {3, 6}}, - {"\U00001160\U00000308\U00000915", {4448, 2325}, {5, 8}}, - {"\U00001160\U0000231a", {4448, 8986}, {3, 6}}, - {"\U00001160\U00000308\U0000231a", {4448, 8986}, {5, 8}}, - {"\U00001160\U00000300", {4448}, {5}}, - {"\U00001160\U00000308\U00000300", {4448}, {7}}, - {"\U00001160\U00000900", {4448}, {6}}, - {"\U00001160\U00000308\U00000900", {4448}, {8}}, - {"\U00001160\U0000094d", {4448}, {6}}, - {"\U00001160\U00000308\U0000094d", {4448}, {8}}, - {"\U00001160\U0000200d", {4448}, {6}}, - {"\U00001160\U00000308\U0000200d", {4448}, {8}}, - {"\U00001160\U00000378", {4448, 888}, {3, 5}}, - {"\U00001160\U00000308\U00000378", {4448, 888}, {5, 7}}, - {"\U000011a8\U00000020", {4520, 32}, {3, 4}}, - {"\U000011a8\U00000308\U00000020", {4520, 32}, {5, 6}}, - {"\U000011a8\U0000000d", {4520, 13}, {3, 4}}, - {"\U000011a8\U00000308\U0000000d", {4520, 13}, {5, 6}}, - {"\U000011a8\U0000000a", {4520, 10}, {3, 4}}, - {"\U000011a8\U00000308\U0000000a", {4520, 10}, {5, 6}}, - {"\U000011a8\U00000001", {4520, 1}, {3, 4}}, - {"\U000011a8\U00000308\U00000001", {4520, 1}, {5, 6}}, - {"\U000011a8\U0000200c", {4520}, {6}}, - {"\U000011a8\U00000308\U0000200c", {4520}, {8}}, - {"\U000011a8\U0001f1e6", {4520, 127462}, {3, 7}}, - {"\U000011a8\U00000308\U0001f1e6", {4520, 127462}, {5, 9}}, - {"\U000011a8\U00000600", {4520, 1536}, {3, 5}}, - {"\U000011a8\U00000308\U00000600", {4520, 1536}, {5, 7}}, - {"\U000011a8\U00000a03", {4520}, {6}}, - {"\U000011a8\U00000308\U00000a03", {4520}, {8}}, - {"\U000011a8\U00001100", {4520, 4352}, {3, 6}}, - {"\U000011a8\U00000308\U00001100", {4520, 4352}, {5, 8}}, - {"\U000011a8\U00001160", {4520, 4448}, {3, 6}}, - {"\U000011a8\U00000308\U00001160", {4520, 4448}, {5, 8}}, - {"\U000011a8\U000011a8", {4520}, {6}}, - {"\U000011a8\U00000308\U000011a8", {4520, 4520}, {5, 8}}, - {"\U000011a8\U0000ac00", {4520, 44032}, {3, 6}}, - {"\U000011a8\U00000308\U0000ac00", {4520, 44032}, {5, 8}}, - {"\U000011a8\U0000ac01", {4520, 44033}, {3, 6}}, - {"\U000011a8\U00000308\U0000ac01", {4520, 44033}, {5, 8}}, - {"\U000011a8\U00000903", {4520}, {6}}, - {"\U000011a8\U00000308\U00000903", {4520}, {8}}, - {"\U000011a8\U00000904", {4520, 2308}, {3, 6}}, - {"\U000011a8\U00000308\U00000904", {4520, 2308}, {5, 8}}, - {"\U000011a8\U00000d4e", {4520, 3406}, {3, 6}}, - {"\U000011a8\U00000308\U00000d4e", {4520, 3406}, {5, 8}}, - {"\U000011a8\U00000915", {4520, 2325}, {3, 6}}, - {"\U000011a8\U00000308\U00000915", {4520, 2325}, {5, 8}}, - {"\U000011a8\U0000231a", {4520, 8986}, {3, 6}}, - {"\U000011a8\U00000308\U0000231a", {4520, 8986}, {5, 8}}, - {"\U000011a8\U00000300", {4520}, {5}}, - {"\U000011a8\U00000308\U00000300", {4520}, {7}}, - {"\U000011a8\U00000900", {4520}, {6}}, - {"\U000011a8\U00000308\U00000900", {4520}, {8}}, - {"\U000011a8\U0000094d", {4520}, {6}}, - {"\U000011a8\U00000308\U0000094d", {4520}, {8}}, - {"\U000011a8\U0000200d", {4520}, {6}}, - {"\U000011a8\U00000308\U0000200d", {4520}, {8}}, - {"\U000011a8\U00000378", {4520, 888}, {3, 5}}, - {"\U000011a8\U00000308\U00000378", {4520, 888}, {5, 7}}, - {"\U0000ac00\U00000020", {44032, 32}, {3, 4}}, - {"\U0000ac00\U00000308\U00000020", {44032, 32}, {5, 6}}, - {"\U0000ac00\U0000000d", {44032, 13}, {3, 4}}, - {"\U0000ac00\U00000308\U0000000d", {44032, 13}, {5, 6}}, - {"\U0000ac00\U0000000a", {44032, 10}, {3, 4}}, - {"\U0000ac00\U00000308\U0000000a", {44032, 10}, {5, 6}}, - {"\U0000ac00\U00000001", {44032, 1}, {3, 4}}, - {"\U0000ac00\U00000308\U00000001", {44032, 1}, {5, 6}}, - {"\U0000ac00\U0000200c", {44032}, {6}}, - {"\U0000ac00\U00000308\U0000200c", {44032}, {8}}, - {"\U0000ac00\U0001f1e6", {44032, 127462}, {3, 7}}, - {"\U0000ac00\U00000308\U0001f1e6", {44032, 127462}, {5, 9}}, - {"\U0000ac00\U00000600", {44032, 1536}, {3, 5}}, - {"\U0000ac00\U00000308\U00000600", {44032, 1536}, {5, 7}}, - {"\U0000ac00\U00000a03", {44032}, {6}}, - {"\U0000ac00\U00000308\U00000a03", {44032}, {8}}, - {"\U0000ac00\U00001100", {44032, 4352}, {3, 6}}, - {"\U0000ac00\U00000308\U00001100", {44032, 4352}, {5, 8}}, - {"\U0000ac00\U00001160", {44032}, {6}}, - {"\U0000ac00\U00000308\U00001160", {44032, 4448}, {5, 8}}, - {"\U0000ac00\U000011a8", {44032}, {6}}, - {"\U0000ac00\U00000308\U000011a8", {44032, 4520}, {5, 8}}, - {"\U0000ac00\U0000ac00", {44032, 44032}, {3, 6}}, - {"\U0000ac00\U00000308\U0000ac00", {44032, 44032}, {5, 8}}, - {"\U0000ac00\U0000ac01", {44032, 44033}, {3, 6}}, - {"\U0000ac00\U00000308\U0000ac01", {44032, 44033}, {5, 8}}, - {"\U0000ac00\U00000903", {44032}, {6}}, - {"\U0000ac00\U00000308\U00000903", {44032}, {8}}, - {"\U0000ac00\U00000904", {44032, 2308}, {3, 6}}, - {"\U0000ac00\U00000308\U00000904", {44032, 2308}, {5, 8}}, - {"\U0000ac00\U00000d4e", {44032, 3406}, {3, 6}}, - {"\U0000ac00\U00000308\U00000d4e", {44032, 3406}, {5, 8}}, - {"\U0000ac00\U00000915", {44032, 2325}, {3, 6}}, - {"\U0000ac00\U00000308\U00000915", {44032, 2325}, {5, 8}}, - {"\U0000ac00\U0000231a", {44032, 8986}, {3, 6}}, - {"\U0000ac00\U00000308\U0000231a", {44032, 8986}, {5, 8}}, - {"\U0000ac00\U00000300", {44032}, {5}}, - {"\U0000ac00\U00000308\U00000300", {44032}, {7}}, - {"\U0000ac00\U00000900", {44032}, {6}}, - {"\U0000ac00\U00000308\U00000900", {44032}, {8}}, - {"\U0000ac00\U0000094d", {44032}, {6}}, - {"\U0000ac00\U00000308\U0000094d", {44032}, {8}}, - {"\U0000ac00\U0000200d", {44032}, {6}}, - {"\U0000ac00\U00000308\U0000200d", {44032}, {8}}, - {"\U0000ac00\U00000378", {44032, 888}, {3, 5}}, - {"\U0000ac00\U00000308\U00000378", {44032, 888}, {5, 7}}, - {"\U0000ac01\U00000020", {44033, 32}, {3, 4}}, - {"\U0000ac01\U00000308\U00000020", {44033, 32}, {5, 6}}, - {"\U0000ac01\U0000000d", {44033, 13}, {3, 4}}, - {"\U0000ac01\U00000308\U0000000d", {44033, 13}, {5, 6}}, - {"\U0000ac01\U0000000a", {44033, 10}, {3, 4}}, - {"\U0000ac01\U00000308\U0000000a", {44033, 10}, {5, 6}}, - {"\U0000ac01\U00000001", {44033, 1}, {3, 4}}, - {"\U0000ac01\U00000308\U00000001", {44033, 1}, {5, 6}}, - {"\U0000ac01\U0000200c", {44033}, {6}}, - {"\U0000ac01\U00000308\U0000200c", {44033}, {8}}, - {"\U0000ac01\U0001f1e6", {44033, 127462}, {3, 7}}, - {"\U0000ac01\U00000308\U0001f1e6", {44033, 127462}, {5, 9}}, - {"\U0000ac01\U00000600", {44033, 1536}, {3, 5}}, - {"\U0000ac01\U00000308\U00000600", {44033, 1536}, {5, 7}}, - {"\U0000ac01\U00000a03", {44033}, {6}}, - {"\U0000ac01\U00000308\U00000a03", {44033}, {8}}, - {"\U0000ac01\U00001100", {44033, 4352}, {3, 6}}, - {"\U0000ac01\U00000308\U00001100", {44033, 4352}, {5, 8}}, - {"\U0000ac01\U00001160", {44033, 4448}, {3, 6}}, - {"\U0000ac01\U00000308\U00001160", {44033, 4448}, {5, 8}}, - {"\U0000ac01\U000011a8", {44033}, {6}}, - {"\U0000ac01\U00000308\U000011a8", {44033, 4520}, {5, 8}}, - {"\U0000ac01\U0000ac00", {44033, 44032}, {3, 6}}, - {"\U0000ac01\U00000308\U0000ac00", {44033, 44032}, {5, 8}}, - {"\U0000ac01\U0000ac01", {44033, 44033}, {3, 6}}, - {"\U0000ac01\U00000308\U0000ac01", {44033, 44033}, {5, 8}}, - {"\U0000ac01\U00000903", {44033}, {6}}, - {"\U0000ac01\U00000308\U00000903", {44033}, {8}}, - {"\U0000ac01\U00000904", {44033, 2308}, {3, 6}}, - {"\U0000ac01\U00000308\U00000904", {44033, 2308}, {5, 8}}, - {"\U0000ac01\U00000d4e", {44033, 3406}, {3, 6}}, - {"\U0000ac01\U00000308\U00000d4e", {44033, 3406}, {5, 8}}, - {"\U0000ac01\U00000915", {44033, 2325}, {3, 6}}, - {"\U0000ac01\U00000308\U00000915", {44033, 2325}, {5, 8}}, - {"\U0000ac01\U0000231a", {44033, 8986}, {3, 6}}, - {"\U0000ac01\U00000308\U0000231a", {44033, 8986}, {5, 8}}, - {"\U0000ac01\U00000300", {44033}, {5}}, - {"\U0000ac01\U00000308\U00000300", {44033}, {7}}, - {"\U0000ac01\U00000900", {44033}, {6}}, - {"\U0000ac01\U00000308\U00000900", {44033}, {8}}, - {"\U0000ac01\U0000094d", {44033}, {6}}, - {"\U0000ac01\U00000308\U0000094d", {44033}, {8}}, - {"\U0000ac01\U0000200d", {44033}, {6}}, - {"\U0000ac01\U00000308\U0000200d", {44033}, {8}}, - {"\U0000ac01\U00000378", {44033, 888}, {3, 5}}, - {"\U0000ac01\U00000308\U00000378", {44033, 888}, {5, 7}}, - {"\U00000903\U00000020", {2307, 32}, {3, 4}}, - {"\U00000903\U00000308\U00000020", {2307, 32}, {5, 6}}, - {"\U00000903\U0000000d", {2307, 13}, {3, 4}}, - {"\U00000903\U00000308\U0000000d", {2307, 13}, {5, 6}}, - {"\U00000903\U0000000a", {2307, 10}, {3, 4}}, - {"\U00000903\U00000308\U0000000a", {2307, 10}, {5, 6}}, - {"\U00000903\U00000001", {2307, 1}, {3, 4}}, - {"\U00000903\U00000308\U00000001", {2307, 1}, {5, 6}}, - {"\U00000903\U0000200c", {2307}, {6}}, - {"\U00000903\U00000308\U0000200c", {2307}, {8}}, - {"\U00000903\U0001f1e6", {2307, 127462}, {3, 7}}, - {"\U00000903\U00000308\U0001f1e6", {2307, 127462}, {5, 9}}, - {"\U00000903\U00000600", {2307, 1536}, {3, 5}}, - {"\U00000903\U00000308\U00000600", {2307, 1536}, {5, 7}}, - {"\U00000903\U00000a03", {2307}, {6}}, - {"\U00000903\U00000308\U00000a03", {2307}, {8}}, - {"\U00000903\U00001100", {2307, 4352}, {3, 6}}, - {"\U00000903\U00000308\U00001100", {2307, 4352}, {5, 8}}, - {"\U00000903\U00001160", {2307, 4448}, {3, 6}}, - {"\U00000903\U00000308\U00001160", {2307, 4448}, {5, 8}}, - {"\U00000903\U000011a8", {2307, 4520}, {3, 6}}, - {"\U00000903\U00000308\U000011a8", {2307, 4520}, {5, 8}}, - {"\U00000903\U0000ac00", {2307, 44032}, {3, 6}}, - {"\U00000903\U00000308\U0000ac00", {2307, 44032}, {5, 8}}, - {"\U00000903\U0000ac01", {2307, 44033}, {3, 6}}, - {"\U00000903\U00000308\U0000ac01", {2307, 44033}, {5, 8}}, - {"\U00000903\U00000903", {2307}, {6}}, - {"\U00000903\U00000308\U00000903", {2307}, {8}}, - {"\U00000903\U00000904", {2307, 2308}, {3, 6}}, - {"\U00000903\U00000308\U00000904", {2307, 2308}, {5, 8}}, - {"\U00000903\U00000d4e", {2307, 3406}, {3, 6}}, - {"\U00000903\U00000308\U00000d4e", {2307, 3406}, {5, 8}}, - {"\U00000903\U00000915", {2307, 2325}, {3, 6}}, - {"\U00000903\U00000308\U00000915", {2307, 2325}, {5, 8}}, - {"\U00000903\U0000231a", {2307, 8986}, {3, 6}}, - {"\U00000903\U00000308\U0000231a", {2307, 8986}, {5, 8}}, - {"\U00000903\U00000300", {2307}, {5}}, - {"\U00000903\U00000308\U00000300", {2307}, {7}}, - {"\U00000903\U00000900", {2307}, {6}}, - {"\U00000903\U00000308\U00000900", {2307}, {8}}, - {"\U00000903\U0000094d", {2307}, {6}}, - {"\U00000903\U00000308\U0000094d", {2307}, {8}}, - {"\U00000903\U0000200d", {2307}, {6}}, - {"\U00000903\U00000308\U0000200d", {2307}, {8}}, - {"\U00000903\U00000378", {2307, 888}, {3, 5}}, - {"\U00000903\U00000308\U00000378", {2307, 888}, {5, 7}}, - {"\U00000904\U00000020", {2308, 32}, {3, 4}}, - {"\U00000904\U00000308\U00000020", {2308, 32}, {5, 6}}, - {"\U00000904\U0000000d", {2308, 13}, {3, 4}}, - {"\U00000904\U00000308\U0000000d", {2308, 13}, {5, 6}}, - {"\U00000904\U0000000a", {2308, 10}, {3, 4}}, - {"\U00000904\U00000308\U0000000a", {2308, 10}, {5, 6}}, - {"\U00000904\U00000001", {2308, 1}, {3, 4}}, - {"\U00000904\U00000308\U00000001", {2308, 1}, {5, 6}}, - {"\U00000904\U0000200c", {2308}, {6}}, - {"\U00000904\U00000308\U0000200c", {2308}, {8}}, - {"\U00000904\U0001f1e6", {2308, 127462}, {3, 7}}, - {"\U00000904\U00000308\U0001f1e6", {2308, 127462}, {5, 9}}, - {"\U00000904\U00000600", {2308, 1536}, {3, 5}}, - {"\U00000904\U00000308\U00000600", {2308, 1536}, {5, 7}}, - {"\U00000904\U00000a03", {2308}, {6}}, - {"\U00000904\U00000308\U00000a03", {2308}, {8}}, - {"\U00000904\U00001100", {2308, 4352}, {3, 6}}, - {"\U00000904\U00000308\U00001100", {2308, 4352}, {5, 8}}, - {"\U00000904\U00001160", {2308, 4448}, {3, 6}}, - {"\U00000904\U00000308\U00001160", {2308, 4448}, {5, 8}}, - {"\U00000904\U000011a8", {2308, 4520}, {3, 6}}, - {"\U00000904\U00000308\U000011a8", {2308, 4520}, {5, 8}}, - {"\U00000904\U0000ac00", {2308, 44032}, {3, 6}}, - {"\U00000904\U00000308\U0000ac00", {2308, 44032}, {5, 8}}, - {"\U00000904\U0000ac01", {2308, 44033}, {3, 6}}, - {"\U00000904\U00000308\U0000ac01", {2308, 44033}, {5, 8}}, - {"\U00000904\U00000903", {2308}, {6}}, - {"\U00000904\U00000308\U00000903", {2308}, {8}}, - {"\U00000904\U00000904", {2308, 2308}, {3, 6}}, - {"\U00000904\U00000308\U00000904", {2308, 2308}, {5, 8}}, - {"\U00000904\U00000d4e", {2308, 3406}, {3, 6}}, - {"\U00000904\U00000308\U00000d4e", {2308, 3406}, {5, 8}}, - {"\U00000904\U00000915", {2308, 2325}, {3, 6}}, - {"\U00000904\U00000308\U00000915", {2308, 2325}, {5, 8}}, - {"\U00000904\U0000231a", {2308, 8986}, {3, 6}}, - {"\U00000904\U00000308\U0000231a", {2308, 8986}, {5, 8}}, - {"\U00000904\U00000300", {2308}, {5}}, - {"\U00000904\U00000308\U00000300", {2308}, {7}}, - {"\U00000904\U00000900", {2308}, {6}}, - {"\U00000904\U00000308\U00000900", {2308}, {8}}, - {"\U00000904\U0000094d", {2308}, {6}}, - {"\U00000904\U00000308\U0000094d", {2308}, {8}}, - {"\U00000904\U0000200d", {2308}, {6}}, - {"\U00000904\U00000308\U0000200d", {2308}, {8}}, - {"\U00000904\U00000378", {2308, 888}, {3, 5}}, - {"\U00000904\U00000308\U00000378", {2308, 888}, {5, 7}}, - {"\U00000d4e\U00000020", {3406}, {4}}, - {"\U00000d4e\U00000308\U00000020", {3406, 32}, {5, 6}}, - {"\U00000d4e\U0000000d", {3406, 13}, {3, 4}}, - {"\U00000d4e\U00000308\U0000000d", {3406, 13}, {5, 6}}, - {"\U00000d4e\U0000000a", {3406, 10}, {3, 4}}, - {"\U00000d4e\U00000308\U0000000a", {3406, 10}, {5, 6}}, - {"\U00000d4e\U00000001", {3406, 1}, {3, 4}}, - {"\U00000d4e\U00000308\U00000001", {3406, 1}, {5, 6}}, - {"\U00000d4e\U0000200c", {3406}, {6}}, - {"\U00000d4e\U00000308\U0000200c", {3406}, {8}}, - {"\U00000d4e\U0001f1e6", {3406}, {7}}, - {"\U00000d4e\U00000308\U0001f1e6", {3406, 127462}, {5, 9}}, - {"\U00000d4e\U00000600", {3406}, {5}}, - {"\U00000d4e\U00000308\U00000600", {3406, 1536}, {5, 7}}, - {"\U00000d4e\U00000a03", {3406}, {6}}, - {"\U00000d4e\U00000308\U00000a03", {3406}, {8}}, - {"\U00000d4e\U00001100", {3406}, {6}}, - {"\U00000d4e\U00000308\U00001100", {3406, 4352}, {5, 8}}, - {"\U00000d4e\U00001160", {3406}, {6}}, - {"\U00000d4e\U00000308\U00001160", {3406, 4448}, {5, 8}}, - {"\U00000d4e\U000011a8", {3406}, {6}}, - {"\U00000d4e\U00000308\U000011a8", {3406, 4520}, {5, 8}}, - {"\U00000d4e\U0000ac00", {3406}, {6}}, - {"\U00000d4e\U00000308\U0000ac00", {3406, 44032}, {5, 8}}, - {"\U00000d4e\U0000ac01", {3406}, {6}}, - {"\U00000d4e\U00000308\U0000ac01", {3406, 44033}, {5, 8}}, - {"\U00000d4e\U00000903", {3406}, {6}}, - {"\U00000d4e\U00000308\U00000903", {3406}, {8}}, - {"\U00000d4e\U00000904", {3406}, {6}}, - {"\U00000d4e\U00000308\U00000904", {3406, 2308}, {5, 8}}, - {"\U00000d4e\U00000d4e", {3406}, {6}}, - {"\U00000d4e\U00000308\U00000d4e", {3406, 3406}, {5, 8}}, - {"\U00000d4e\U00000915", {3406}, {6}}, - {"\U00000d4e\U00000308\U00000915", {3406, 2325}, {5, 8}}, - {"\U00000d4e\U0000231a", {3406}, {6}}, - {"\U00000d4e\U00000308\U0000231a", {3406, 8986}, {5, 8}}, - {"\U00000d4e\U00000300", {3406}, {5}}, - {"\U00000d4e\U00000308\U00000300", {3406}, {7}}, - {"\U00000d4e\U00000900", {3406}, {6}}, - {"\U00000d4e\U00000308\U00000900", {3406}, {8}}, - {"\U00000d4e\U0000094d", {3406}, {6}}, - {"\U00000d4e\U00000308\U0000094d", {3406}, {8}}, - {"\U00000d4e\U0000200d", {3406}, {6}}, - {"\U00000d4e\U00000308\U0000200d", {3406}, {8}}, - {"\U00000d4e\U00000378", {3406}, {5}}, - {"\U00000d4e\U00000308\U00000378", {3406, 888}, {5, 7}}, - {"\U00000915\U00000020", {2325, 32}, {3, 4}}, - {"\U00000915\U00000308\U00000020", {2325, 32}, {5, 6}}, - {"\U00000915\U0000000d", {2325, 13}, {3, 4}}, - {"\U00000915\U00000308\U0000000d", {2325, 13}, {5, 6}}, - {"\U00000915\U0000000a", {2325, 10}, {3, 4}}, - {"\U00000915\U00000308\U0000000a", {2325, 10}, {5, 6}}, - {"\U00000915\U00000001", {2325, 1}, {3, 4}}, - {"\U00000915\U00000308\U00000001", {2325, 1}, {5, 6}}, - {"\U00000915\U0000200c", {2325}, {6}}, - {"\U00000915\U00000308\U0000200c", {2325}, {8}}, - {"\U00000915\U0001f1e6", {2325, 127462}, {3, 7}}, - {"\U00000915\U00000308\U0001f1e6", {2325, 127462}, {5, 9}}, - {"\U00000915\U00000600", {2325, 1536}, {3, 5}}, - {"\U00000915\U00000308\U00000600", {2325, 1536}, {5, 7}}, - {"\U00000915\U00000a03", {2325}, {6}}, - {"\U00000915\U00000308\U00000a03", {2325}, {8}}, - {"\U00000915\U00001100", {2325, 4352}, {3, 6}}, - {"\U00000915\U00000308\U00001100", {2325, 4352}, {5, 8}}, - {"\U00000915\U00001160", {2325, 4448}, {3, 6}}, - {"\U00000915\U00000308\U00001160", {2325, 4448}, {5, 8}}, - {"\U00000915\U000011a8", {2325, 4520}, {3, 6}}, - {"\U00000915\U00000308\U000011a8", {2325, 4520}, {5, 8}}, - {"\U00000915\U0000ac00", {2325, 44032}, {3, 6}}, - {"\U00000915\U00000308\U0000ac00", {2325, 44032}, {5, 8}}, - {"\U00000915\U0000ac01", {2325, 44033}, {3, 6}}, - {"\U00000915\U00000308\U0000ac01", {2325, 44033}, {5, 8}}, - {"\U00000915\U00000903", {2325}, {6}}, - {"\U00000915\U00000308\U00000903", {2325}, {8}}, - {"\U00000915\U00000904", {2325, 2308}, {3, 6}}, - {"\U00000915\U00000308\U00000904", {2325, 2308}, {5, 8}}, - {"\U00000915\U00000d4e", {2325, 3406}, {3, 6}}, - {"\U00000915\U00000308\U00000d4e", {2325, 3406}, {5, 8}}, - {"\U00000915\U00000915", {2325, 2325}, {3, 6}}, - {"\U00000915\U00000308\U00000915", {2325, 2325}, {5, 8}}, - {"\U00000915\U0000231a", {2325, 8986}, {3, 6}}, - {"\U00000915\U00000308\U0000231a", {2325, 8986}, {5, 8}}, - {"\U00000915\U00000300", {2325}, {5}}, - {"\U00000915\U00000308\U00000300", {2325}, {7}}, - {"\U00000915\U00000900", {2325}, {6}}, - {"\U00000915\U00000308\U00000900", {2325}, {8}}, - {"\U00000915\U0000094d", {2325}, {6}}, - {"\U00000915\U00000308\U0000094d", {2325}, {8}}, - {"\U00000915\U0000200d", {2325}, {6}}, - {"\U00000915\U00000308\U0000200d", {2325}, {8}}, - {"\U00000915\U00000378", {2325, 888}, {3, 5}}, - {"\U00000915\U00000308\U00000378", {2325, 888}, {5, 7}}, - {"\U0000231a\U00000020", {8986, 32}, {3, 4}}, - {"\U0000231a\U00000308\U00000020", {8986, 32}, {5, 6}}, - {"\U0000231a\U0000000d", {8986, 13}, {3, 4}}, - {"\U0000231a\U00000308\U0000000d", {8986, 13}, {5, 6}}, - {"\U0000231a\U0000000a", {8986, 10}, {3, 4}}, - {"\U0000231a\U00000308\U0000000a", {8986, 10}, {5, 6}}, - {"\U0000231a\U00000001", {8986, 1}, {3, 4}}, - {"\U0000231a\U00000308\U00000001", {8986, 1}, {5, 6}}, - {"\U0000231a\U0000200c", {8986}, {6}}, - {"\U0000231a\U00000308\U0000200c", {8986}, {8}}, - {"\U0000231a\U0001f1e6", {8986, 127462}, {3, 7}}, - {"\U0000231a\U00000308\U0001f1e6", {8986, 127462}, {5, 9}}, - {"\U0000231a\U00000600", {8986, 1536}, {3, 5}}, - {"\U0000231a\U00000308\U00000600", {8986, 1536}, {5, 7}}, - {"\U0000231a\U00000a03", {8986}, {6}}, - {"\U0000231a\U00000308\U00000a03", {8986}, {8}}, - {"\U0000231a\U00001100", {8986, 4352}, {3, 6}}, - {"\U0000231a\U00000308\U00001100", {8986, 4352}, {5, 8}}, - {"\U0000231a\U00001160", {8986, 4448}, {3, 6}}, - {"\U0000231a\U00000308\U00001160", {8986, 4448}, {5, 8}}, - {"\U0000231a\U000011a8", {8986, 4520}, {3, 6}}, - {"\U0000231a\U00000308\U000011a8", {8986, 4520}, {5, 8}}, - {"\U0000231a\U0000ac00", {8986, 44032}, {3, 6}}, - {"\U0000231a\U00000308\U0000ac00", {8986, 44032}, {5, 8}}, - {"\U0000231a\U0000ac01", {8986, 44033}, {3, 6}}, - {"\U0000231a\U00000308\U0000ac01", {8986, 44033}, {5, 8}}, - {"\U0000231a\U00000903", {8986}, {6}}, - {"\U0000231a\U00000308\U00000903", {8986}, {8}}, - {"\U0000231a\U00000904", {8986, 2308}, {3, 6}}, - {"\U0000231a\U00000308\U00000904", {8986, 2308}, {5, 8}}, - {"\U0000231a\U00000d4e", {8986, 3406}, {3, 6}}, - {"\U0000231a\U00000308\U00000d4e", {8986, 3406}, {5, 8}}, - {"\U0000231a\U00000915", {8986, 2325}, {3, 6}}, - {"\U0000231a\U00000308\U00000915", {8986, 2325}, {5, 8}}, - {"\U0000231a\U0000231a", {8986, 8986}, {3, 6}}, - {"\U0000231a\U00000308\U0000231a", {8986, 8986}, {5, 8}}, - {"\U0000231a\U00000300", {8986}, {5}}, - {"\U0000231a\U00000308\U00000300", {8986}, {7}}, - {"\U0000231a\U00000900", {8986}, {6}}, - {"\U0000231a\U00000308\U00000900", {8986}, {8}}, - {"\U0000231a\U0000094d", {8986}, {6}}, - {"\U0000231a\U00000308\U0000094d", {8986}, {8}}, - {"\U0000231a\U0000200d", {8986}, {6}}, - {"\U0000231a\U00000308\U0000200d", {8986}, {8}}, - {"\U0000231a\U00000378", {8986, 888}, {3, 5}}, - {"\U0000231a\U00000308\U00000378", {8986, 888}, {5, 7}}, - {"\U00000300\U00000020", {768, 32}, {2, 3}}, - {"\U00000300\U00000308\U00000020", {768, 32}, {4, 5}}, - {"\U00000300\U0000000d", {768, 13}, {2, 3}}, - {"\U00000300\U00000308\U0000000d", {768, 13}, {4, 5}}, - {"\U00000300\U0000000a", {768, 10}, {2, 3}}, - {"\U00000300\U00000308\U0000000a", {768, 10}, {4, 5}}, - {"\U00000300\U00000001", {768, 1}, {2, 3}}, - {"\U00000300\U00000308\U00000001", {768, 1}, {4, 5}}, - {"\U00000300\U0000200c", {768}, {5}}, - {"\U00000300\U00000308\U0000200c", {768}, {7}}, - {"\U00000300\U0001f1e6", {768, 127462}, {2, 6}}, - {"\U00000300\U00000308\U0001f1e6", {768, 127462}, {4, 8}}, - {"\U00000300\U00000600", {768, 1536}, {2, 4}}, - {"\U00000300\U00000308\U00000600", {768, 1536}, {4, 6}}, - {"\U00000300\U00000a03", {768}, {5}}, - {"\U00000300\U00000308\U00000a03", {768}, {7}}, - {"\U00000300\U00001100", {768, 4352}, {2, 5}}, - {"\U00000300\U00000308\U00001100", {768, 4352}, {4, 7}}, - {"\U00000300\U00001160", {768, 4448}, {2, 5}}, - {"\U00000300\U00000308\U00001160", {768, 4448}, {4, 7}}, - {"\U00000300\U000011a8", {768, 4520}, {2, 5}}, - {"\U00000300\U00000308\U000011a8", {768, 4520}, {4, 7}}, - {"\U00000300\U0000ac00", {768, 44032}, {2, 5}}, - {"\U00000300\U00000308\U0000ac00", {768, 44032}, {4, 7}}, - {"\U00000300\U0000ac01", {768, 44033}, {2, 5}}, - {"\U00000300\U00000308\U0000ac01", {768, 44033}, {4, 7}}, - {"\U00000300\U00000903", {768}, {5}}, - {"\U00000300\U00000308\U00000903", {768}, {7}}, - {"\U00000300\U00000904", {768, 2308}, {2, 5}}, - {"\U00000300\U00000308\U00000904", {768, 2308}, {4, 7}}, - {"\U00000300\U00000d4e", {768, 3406}, {2, 5}}, - {"\U00000300\U00000308\U00000d4e", {768, 3406}, {4, 7}}, - {"\U00000300\U00000915", {768, 2325}, {2, 5}}, - {"\U00000300\U00000308\U00000915", {768, 2325}, {4, 7}}, - {"\U00000300\U0000231a", {768, 8986}, {2, 5}}, - {"\U00000300\U00000308\U0000231a", {768, 8986}, {4, 7}}, - {"\U00000300\U00000300", {768}, {4}}, - {"\U00000300\U00000308\U00000300", {768}, {6}}, - {"\U00000300\U00000900", {768}, {5}}, - {"\U00000300\U00000308\U00000900", {768}, {7}}, - {"\U00000300\U0000094d", {768}, {5}}, - {"\U00000300\U00000308\U0000094d", {768}, {7}}, - {"\U00000300\U0000200d", {768}, {5}}, - {"\U00000300\U00000308\U0000200d", {768}, {7}}, - {"\U00000300\U00000378", {768, 888}, {2, 4}}, - {"\U00000300\U00000308\U00000378", {768, 888}, {4, 6}}, - {"\U00000900\U00000020", {2304, 32}, {3, 4}}, - {"\U00000900\U00000308\U00000020", {2304, 32}, {5, 6}}, - {"\U00000900\U0000000d", {2304, 13}, {3, 4}}, - {"\U00000900\U00000308\U0000000d", {2304, 13}, {5, 6}}, - {"\U00000900\U0000000a", {2304, 10}, {3, 4}}, - {"\U00000900\U00000308\U0000000a", {2304, 10}, {5, 6}}, - {"\U00000900\U00000001", {2304, 1}, {3, 4}}, - {"\U00000900\U00000308\U00000001", {2304, 1}, {5, 6}}, - {"\U00000900\U0000200c", {2304}, {6}}, - {"\U00000900\U00000308\U0000200c", {2304}, {8}}, - {"\U00000900\U0001f1e6", {2304, 127462}, {3, 7}}, - {"\U00000900\U00000308\U0001f1e6", {2304, 127462}, {5, 9}}, - {"\U00000900\U00000600", {2304, 1536}, {3, 5}}, - {"\U00000900\U00000308\U00000600", {2304, 1536}, {5, 7}}, - {"\U00000900\U00000a03", {2304}, {6}}, - {"\U00000900\U00000308\U00000a03", {2304}, {8}}, - {"\U00000900\U00001100", {2304, 4352}, {3, 6}}, - {"\U00000900\U00000308\U00001100", {2304, 4352}, {5, 8}}, - {"\U00000900\U00001160", {2304, 4448}, {3, 6}}, - {"\U00000900\U00000308\U00001160", {2304, 4448}, {5, 8}}, - {"\U00000900\U000011a8", {2304, 4520}, {3, 6}}, - {"\U00000900\U00000308\U000011a8", {2304, 4520}, {5, 8}}, - {"\U00000900\U0000ac00", {2304, 44032}, {3, 6}}, - {"\U00000900\U00000308\U0000ac00", {2304, 44032}, {5, 8}}, - {"\U00000900\U0000ac01", {2304, 44033}, {3, 6}}, - {"\U00000900\U00000308\U0000ac01", {2304, 44033}, {5, 8}}, - {"\U00000900\U00000903", {2304}, {6}}, - {"\U00000900\U00000308\U00000903", {2304}, {8}}, - {"\U00000900\U00000904", {2304, 2308}, {3, 6}}, - {"\U00000900\U00000308\U00000904", {2304, 2308}, {5, 8}}, - {"\U00000900\U00000d4e", {2304, 3406}, {3, 6}}, - {"\U00000900\U00000308\U00000d4e", {2304, 3406}, {5, 8}}, - {"\U00000900\U00000915", {2304, 2325}, {3, 6}}, - {"\U00000900\U00000308\U00000915", {2304, 2325}, {5, 8}}, - {"\U00000900\U0000231a", {2304, 8986}, {3, 6}}, - {"\U00000900\U00000308\U0000231a", {2304, 8986}, {5, 8}}, - {"\U00000900\U00000300", {2304}, {5}}, - {"\U00000900\U00000308\U00000300", {2304}, {7}}, - {"\U00000900\U00000900", {2304}, {6}}, - {"\U00000900\U00000308\U00000900", {2304}, {8}}, - {"\U00000900\U0000094d", {2304}, {6}}, - {"\U00000900\U00000308\U0000094d", {2304}, {8}}, - {"\U00000900\U0000200d", {2304}, {6}}, - {"\U00000900\U00000308\U0000200d", {2304}, {8}}, - {"\U00000900\U00000378", {2304, 888}, {3, 5}}, - {"\U00000900\U00000308\U00000378", {2304, 888}, {5, 7}}, - {"\U0000094d\U00000020", {2381, 32}, {3, 4}}, - {"\U0000094d\U00000308\U00000020", {2381, 32}, {5, 6}}, - {"\U0000094d\U0000000d", {2381, 13}, {3, 4}}, - {"\U0000094d\U00000308\U0000000d", {2381, 13}, {5, 6}}, - {"\U0000094d\U0000000a", {2381, 10}, {3, 4}}, - {"\U0000094d\U00000308\U0000000a", {2381, 10}, {5, 6}}, - {"\U0000094d\U00000001", {2381, 1}, {3, 4}}, - {"\U0000094d\U00000308\U00000001", {2381, 1}, {5, 6}}, - {"\U0000094d\U0000200c", {2381}, {6}}, - {"\U0000094d\U00000308\U0000200c", {2381}, {8}}, - {"\U0000094d\U0001f1e6", {2381, 127462}, {3, 7}}, - {"\U0000094d\U00000308\U0001f1e6", {2381, 127462}, {5, 9}}, - {"\U0000094d\U00000600", {2381, 1536}, {3, 5}}, - {"\U0000094d\U00000308\U00000600", {2381, 1536}, {5, 7}}, - {"\U0000094d\U00000a03", {2381}, {6}}, - {"\U0000094d\U00000308\U00000a03", {2381}, {8}}, - {"\U0000094d\U00001100", {2381, 4352}, {3, 6}}, - {"\U0000094d\U00000308\U00001100", {2381, 4352}, {5, 8}}, - {"\U0000094d\U00001160", {2381, 4448}, {3, 6}}, - {"\U0000094d\U00000308\U00001160", {2381, 4448}, {5, 8}}, - {"\U0000094d\U000011a8", {2381, 4520}, {3, 6}}, - {"\U0000094d\U00000308\U000011a8", {2381, 4520}, {5, 8}}, - {"\U0000094d\U0000ac00", {2381, 44032}, {3, 6}}, - {"\U0000094d\U00000308\U0000ac00", {2381, 44032}, {5, 8}}, - {"\U0000094d\U0000ac01", {2381, 44033}, {3, 6}}, - {"\U0000094d\U00000308\U0000ac01", {2381, 44033}, {5, 8}}, - {"\U0000094d\U00000903", {2381}, {6}}, - {"\U0000094d\U00000308\U00000903", {2381}, {8}}, - {"\U0000094d\U00000904", {2381, 2308}, {3, 6}}, - {"\U0000094d\U00000308\U00000904", {2381, 2308}, {5, 8}}, - {"\U0000094d\U00000d4e", {2381, 3406}, {3, 6}}, - {"\U0000094d\U00000308\U00000d4e", {2381, 3406}, {5, 8}}, - {"\U0000094d\U00000915", {2381, 2325}, {3, 6}}, - {"\U0000094d\U00000308\U00000915", {2381, 2325}, {5, 8}}, - {"\U0000094d\U0000231a", {2381, 8986}, {3, 6}}, - {"\U0000094d\U00000308\U0000231a", {2381, 8986}, {5, 8}}, - {"\U0000094d\U00000300", {2381}, {5}}, - {"\U0000094d\U00000308\U00000300", {2381}, {7}}, - {"\U0000094d\U00000900", {2381}, {6}}, - {"\U0000094d\U00000308\U00000900", {2381}, {8}}, - {"\U0000094d\U0000094d", {2381}, {6}}, - {"\U0000094d\U00000308\U0000094d", {2381}, {8}}, - {"\U0000094d\U0000200d", {2381}, {6}}, - {"\U0000094d\U00000308\U0000200d", {2381}, {8}}, - {"\U0000094d\U00000378", {2381, 888}, {3, 5}}, - {"\U0000094d\U00000308\U00000378", {2381, 888}, {5, 7}}, - {"\U0000200d\U00000020", {8205, 32}, {3, 4}}, - {"\U0000200d\U00000308\U00000020", {8205, 32}, {5, 6}}, - {"\U0000200d\U0000000d", {8205, 13}, {3, 4}}, - {"\U0000200d\U00000308\U0000000d", {8205, 13}, {5, 6}}, - {"\U0000200d\U0000000a", {8205, 10}, {3, 4}}, - {"\U0000200d\U00000308\U0000000a", {8205, 10}, {5, 6}}, - {"\U0000200d\U00000001", {8205, 1}, {3, 4}}, - {"\U0000200d\U00000308\U00000001", {8205, 1}, {5, 6}}, - {"\U0000200d\U0000200c", {8205}, {6}}, - {"\U0000200d\U00000308\U0000200c", {8205}, {8}}, - {"\U0000200d\U0001f1e6", {8205, 127462}, {3, 7}}, - {"\U0000200d\U00000308\U0001f1e6", {8205, 127462}, {5, 9}}, - {"\U0000200d\U00000600", {8205, 1536}, {3, 5}}, - {"\U0000200d\U00000308\U00000600", {8205, 1536}, {5, 7}}, - {"\U0000200d\U00000a03", {8205}, {6}}, - {"\U0000200d\U00000308\U00000a03", {8205}, {8}}, - {"\U0000200d\U00001100", {8205, 4352}, {3, 6}}, - {"\U0000200d\U00000308\U00001100", {8205, 4352}, {5, 8}}, - {"\U0000200d\U00001160", {8205, 4448}, {3, 6}}, - {"\U0000200d\U00000308\U00001160", {8205, 4448}, {5, 8}}, - {"\U0000200d\U000011a8", {8205, 4520}, {3, 6}}, - {"\U0000200d\U00000308\U000011a8", {8205, 4520}, {5, 8}}, - {"\U0000200d\U0000ac00", {8205, 44032}, {3, 6}}, - {"\U0000200d\U00000308\U0000ac00", {8205, 44032}, {5, 8}}, - {"\U0000200d\U0000ac01", {8205, 44033}, {3, 6}}, - {"\U0000200d\U00000308\U0000ac01", {8205, 44033}, {5, 8}}, - {"\U0000200d\U00000903", {8205}, {6}}, - {"\U0000200d\U00000308\U00000903", {8205}, {8}}, - {"\U0000200d\U00000904", {8205, 2308}, {3, 6}}, - {"\U0000200d\U00000308\U00000904", {8205, 2308}, {5, 8}}, - {"\U0000200d\U00000d4e", {8205, 3406}, {3, 6}}, - {"\U0000200d\U00000308\U00000d4e", {8205, 3406}, {5, 8}}, - {"\U0000200d\U00000915", {8205, 2325}, {3, 6}}, - {"\U0000200d\U00000308\U00000915", {8205, 2325}, {5, 8}}, - {"\U0000200d\U0000231a", {8205, 8986}, {3, 6}}, - {"\U0000200d\U00000308\U0000231a", {8205, 8986}, {5, 8}}, - {"\U0000200d\U00000300", {8205}, {5}}, - {"\U0000200d\U00000308\U00000300", {8205}, {7}}, - {"\U0000200d\U00000900", {8205}, {6}}, - {"\U0000200d\U00000308\U00000900", {8205}, {8}}, - {"\U0000200d\U0000094d", {8205}, {6}}, - {"\U0000200d\U00000308\U0000094d", {8205}, {8}}, - {"\U0000200d\U0000200d", {8205}, {6}}, - {"\U0000200d\U00000308\U0000200d", {8205}, {8}}, - {"\U0000200d\U00000378", {8205, 888}, {3, 5}}, - {"\U0000200d\U00000308\U00000378", {8205, 888}, {5, 7}}, - {"\U00000378\U00000020", {888, 32}, {2, 3}}, - {"\U00000378\U00000308\U00000020", {888, 32}, {4, 5}}, - {"\U00000378\U0000000d", {888, 13}, {2, 3}}, - {"\U00000378\U00000308\U0000000d", {888, 13}, {4, 5}}, - {"\U00000378\U0000000a", {888, 10}, {2, 3}}, - {"\U00000378\U00000308\U0000000a", {888, 10}, {4, 5}}, - {"\U00000378\U00000001", {888, 1}, {2, 3}}, - {"\U00000378\U00000308\U00000001", {888, 1}, {4, 5}}, - {"\U00000378\U0000200c", {888}, {5}}, - {"\U00000378\U00000308\U0000200c", {888}, {7}}, - {"\U00000378\U0001f1e6", {888, 127462}, {2, 6}}, - {"\U00000378\U00000308\U0001f1e6", {888, 127462}, {4, 8}}, - {"\U00000378\U00000600", {888, 1536}, {2, 4}}, - {"\U00000378\U00000308\U00000600", {888, 1536}, {4, 6}}, - {"\U00000378\U00000a03", {888}, {5}}, - {"\U00000378\U00000308\U00000a03", {888}, {7}}, - {"\U00000378\U00001100", {888, 4352}, {2, 5}}, - {"\U00000378\U00000308\U00001100", {888, 4352}, {4, 7}}, - {"\U00000378\U00001160", {888, 4448}, {2, 5}}, - {"\U00000378\U00000308\U00001160", {888, 4448}, {4, 7}}, - {"\U00000378\U000011a8", {888, 4520}, {2, 5}}, - {"\U00000378\U00000308\U000011a8", {888, 4520}, {4, 7}}, - {"\U00000378\U0000ac00", {888, 44032}, {2, 5}}, - {"\U00000378\U00000308\U0000ac00", {888, 44032}, {4, 7}}, - {"\U00000378\U0000ac01", {888, 44033}, {2, 5}}, - {"\U00000378\U00000308\U0000ac01", {888, 44033}, {4, 7}}, - {"\U00000378\U00000903", {888}, {5}}, - {"\U00000378\U00000308\U00000903", {888}, {7}}, - {"\U00000378\U00000904", {888, 2308}, {2, 5}}, - {"\U00000378\U00000308\U00000904", {888, 2308}, {4, 7}}, - {"\U00000378\U00000d4e", {888, 3406}, {2, 5}}, - {"\U00000378\U00000308\U00000d4e", {888, 3406}, {4, 7}}, - {"\U00000378\U00000915", {888, 2325}, {2, 5}}, - {"\U00000378\U00000308\U00000915", {888, 2325}, {4, 7}}, - {"\U00000378\U0000231a", {888, 8986}, {2, 5}}, - {"\U00000378\U00000308\U0000231a", {888, 8986}, {4, 7}}, - {"\U00000378\U00000300", {888}, {4}}, - {"\U00000378\U00000308\U00000300", {888}, {6}}, - {"\U00000378\U00000900", {888}, {5}}, - {"\U00000378\U00000308\U00000900", {888}, {7}}, - {"\U00000378\U0000094d", {888}, {5}}, - {"\U00000378\U00000308\U0000094d", {888}, {7}}, - {"\U00000378\U0000200d", {888}, {5}}, - {"\U00000378\U00000308\U0000200d", {888}, {7}}, - {"\U00000378\U00000378", {888, 888}, {2, 4}}, - {"\U00000378\U00000308\U00000378", {888, 888}, {4, 6}}, - {"\U0000000d\U0000000a\U00000061\U0000000a\U00000308", {13, 97, 10, 776}, {2, 3, 4, 6}}, - {"\U00000061\U00000308", {97}, {3}}, - {"\U00000020\U0000200d\U00000646", {32, 1606}, {4, 6}}, - {"\U00000646\U0000200d\U00000020", {1606, 32}, {5, 6}}, - {"\U00001100\U00001100", {4352}, {6}}, - {"\U0000ac00\U000011a8\U00001100", {44032, 4352}, {6, 9}}, - {"\U0000ac01\U000011a8\U00001100", {44033, 4352}, {6, 9}}, - {"\U0001f1e6\U0001f1e7\U0001f1e8\U00000062", {127462, 127464, 98}, {8, 12, 13}}, - {"\U00000061\U0001f1e6\U0001f1e7\U0001f1e8\U00000062", {97, 127462, 127464, 98}, {1, 9, 13, 14}}, - {"\U00000061\U0001f1e6\U0001f1e7\U0000200d\U0001f1e8\U00000062", {97, 127462, 127464, 98}, {1, 12, 16, 17}}, - {"\U00000061\U0001f1e6\U0000200d\U0001f1e7\U0001f1e8\U00000062", {97, 127462, 127463, 98}, {1, 8, 16, 17}}, - {"\U00000061\U0001f1e6\U0001f1e7\U0001f1e8\U0001f1e9\U00000062", {97, 127462, 127464, 98}, {1, 9, 17, 18}}, - {"\U00000061\U0000200d", {97}, {4}}, - {"\U00000061\U00000308\U00000062", {97, 98}, {3, 4}}, - {"\U00000061\U00000903\U00000062", {97, 98}, {4, 5}}, - {"\U00000061\U00000600\U00000062", {97, 1536}, {1, 4}}, - {"\U0001f476\U0001f3ff\U0001f476", {128118, 128118}, {8, 12}}, - {"\U00000061\U0001f3ff\U0001f476", {97, 128118}, {5, 9}}, - {"\U00000061\U0001f3ff\U0001f476\U0000200d\U0001f6d1", {97, 128118}, {5, 16}}, - {"\U0001f476\U0001f3ff\U00000308\U0000200d\U0001f476\U0001f3ff", {128118}, {21}}, - {"\U0001f6d1\U0000200d\U0001f6d1", {128721}, {11}}, - {"\U00000061\U0000200d\U0001f6d1", {97, 128721}, {4, 8}}, - {"\U00002701\U0000200d\U00002701", {9985}, {9}}, - {"\U00000061\U0000200d\U00002701", {97, 9985}, {4, 7}}, - {"\U00000915\U00000924", {2325, 2340}, {3, 6}}, - {"\U00000915\U0000094d\U00000924", {2325}, {9}}, - {"\U00000915\U0000094d\U0000094d\U00000924", {2325}, {12}}, - {"\U00000915\U0000094d\U0000200d\U00000924", {2325}, {12}}, - {"\U00000915\U0000093c\U0000200d\U0000094d\U00000924", {2325}, {15}}, - {"\U00000915\U0000093c\U0000094d\U0000200d\U00000924", {2325}, {15}}, - {"\U00000915\U0000094d\U00000924\U0000094d\U0000092f", {2325}, {15}}, - {"\U00000915\U0000094d\U00000061", {2325, 97}, {6, 7}}, - {"\U00000061\U0000094d\U00000924", {97, 2340}, {4, 7}}, - {"\U0000003f\U0000094d\U00000924", {63, 2340}, {4, 7}}, - {"\U00000915\U0000094d\U0000094d\U00000924", {2325}, {12}}}}; - -/// The data for UTF-16. -/// -/// Note that most of the data for the UTF-16 and UTF-32 are identical. However -/// since the size of the code units differ the breaks can contain different -/// values. -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -std::array<data<wchar_t>, 1093> data_utf16 = {{ - {L"\U00000020\U00000020", {32, 32}, {1, 2}}, - {L"\U00000020\U00000308\U00000020", {32, 32}, {2, 3}}, - {L"\U00000020\U0000000d", {32, 13}, {1, 2}}, - {L"\U00000020\U00000308\U0000000d", {32, 13}, {2, 3}}, - {L"\U00000020\U0000000a", {32, 10}, {1, 2}}, - {L"\U00000020\U00000308\U0000000a", {32, 10}, {2, 3}}, - {L"\U00000020\U00000001", {32, 1}, {1, 2}}, - {L"\U00000020\U00000308\U00000001", {32, 1}, {2, 3}}, - {L"\U00000020\U0000200c", {32}, {2}}, - {L"\U00000020\U00000308\U0000200c", {32}, {3}}, - {L"\U00000020\U0001f1e6", {32, 127462}, {1, 3}}, - {L"\U00000020\U00000308\U0001f1e6", {32, 127462}, {2, 4}}, - {L"\U00000020\U00000600", {32, 1536}, {1, 2}}, - {L"\U00000020\U00000308\U00000600", {32, 1536}, {2, 3}}, - {L"\U00000020\U00000a03", {32}, {2}}, - {L"\U00000020\U00000308\U00000a03", {32}, {3}}, - {L"\U00000020\U00001100", {32, 4352}, {1, 2}}, - {L"\U00000020\U00000308\U00001100", {32, 4352}, {2, 3}}, - {L"\U00000020\U00001160", {32, 4448}, {1, 2}}, - {L"\U00000020\U00000308\U00001160", {32, 4448}, {2, 3}}, - {L"\U00000020\U000011a8", {32, 4520}, {1, 2}}, - {L"\U00000020\U00000308\U000011a8", {32, 4520}, {2, 3}}, - {L"\U00000020\U0000ac00", {32, 44032}, {1, 2}}, - {L"\U00000020\U00000308\U0000ac00", {32, 44032}, {2, 3}}, - {L"\U00000020\U0000ac01", {32, 44033}, {1, 2}}, - {L"\U00000020\U00000308\U0000ac01", {32, 44033}, {2, 3}}, - {L"\U00000020\U00000903", {32}, {2}}, - {L"\U00000020\U00000308\U00000903", {32}, {3}}, - {L"\U00000020\U00000904", {32, 2308}, {1, 2}}, - {L"\U00000020\U00000308\U00000904", {32, 2308}, {2, 3}}, - {L"\U00000020\U00000d4e", {32, 3406}, {1, 2}}, - {L"\U00000020\U00000308\U00000d4e", {32, 3406}, {2, 3}}, - {L"\U00000020\U00000915", {32, 2325}, {1, 2}}, - {L"\U00000020\U00000308\U00000915", {32, 2325}, {2, 3}}, - {L"\U00000020\U0000231a", {32, 8986}, {1, 2}}, - {L"\U00000020\U00000308\U0000231a", {32, 8986}, {2, 3}}, - {L"\U00000020\U00000300", {32}, {2}}, - {L"\U00000020\U00000308\U00000300", {32}, {3}}, - {L"\U00000020\U00000900", {32}, {2}}, - {L"\U00000020\U00000308\U00000900", {32}, {3}}, - {L"\U00000020\U0000094d", {32}, {2}}, - {L"\U00000020\U00000308\U0000094d", {32}, {3}}, - {L"\U00000020\U0000200d", {32}, {2}}, - {L"\U00000020\U00000308\U0000200d", {32}, {3}}, - {L"\U00000020\U00000378", {32, 888}, {1, 2}}, - {L"\U00000020\U00000308\U00000378", {32, 888}, {2, 3}}, - {L"\U0000000d\U00000020", {13, 32}, {1, 2}}, - {L"\U0000000d\U00000308\U00000020", {13, 776, 32}, {1, 2, 3}}, - {L"\U0000000d\U0000000d", {13, 13}, {1, 2}}, - {L"\U0000000d\U00000308\U0000000d", {13, 776, 13}, {1, 2, 3}}, - {L"\U0000000d\U0000000a", {13}, {2}}, - {L"\U0000000d\U00000308\U0000000a", {13, 776, 10}, {1, 2, 3}}, - {L"\U0000000d\U00000001", {13, 1}, {1, 2}}, - {L"\U0000000d\U00000308\U00000001", {13, 776, 1}, {1, 2, 3}}, - {L"\U0000000d\U0000200c", {13, 8204}, {1, 2}}, - {L"\U0000000d\U00000308\U0000200c", {13, 776}, {1, 3}}, - {L"\U0000000d\U0001f1e6", {13, 127462}, {1, 3}}, - {L"\U0000000d\U00000308\U0001f1e6", {13, 776, 127462}, {1, 2, 4}}, - {L"\U0000000d\U00000600", {13, 1536}, {1, 2}}, - {L"\U0000000d\U00000308\U00000600", {13, 776, 1536}, {1, 2, 3}}, - {L"\U0000000d\U00000a03", {13, 2563}, {1, 2}}, - {L"\U0000000d\U00000308\U00000a03", {13, 776}, {1, 3}}, - {L"\U0000000d\U00001100", {13, 4352}, {1, 2}}, - {L"\U0000000d\U00000308\U00001100", {13, 776, 4352}, {1, 2, 3}}, - {L"\U0000000d\U00001160", {13, 4448}, {1, 2}}, - {L"\U0000000d\U00000308\U00001160", {13, 776, 4448}, {1, 2, 3}}, - {L"\U0000000d\U000011a8", {13, 4520}, {1, 2}}, - {L"\U0000000d\U00000308\U000011a8", {13, 776, 4520}, {1, 2, 3}}, - {L"\U0000000d\U0000ac00", {13, 44032}, {1, 2}}, - {L"\U0000000d\U00000308\U0000ac00", {13, 776, 44032}, {1, 2, 3}}, - {L"\U0000000d\U0000ac01", {13, 44033}, {1, 2}}, - {L"\U0000000d\U00000308\U0000ac01", {13, 776, 44033}, {1, 2, 3}}, - {L"\U0000000d\U00000903", {13, 2307}, {1, 2}}, - {L"\U0000000d\U00000308\U00000903", {13, 776}, {1, 3}}, - {L"\U0000000d\U00000904", {13, 2308}, {1, 2}}, - {L"\U0000000d\U00000308\U00000904", {13, 776, 2308}, {1, 2, 3}}, - {L"\U0000000d\U00000d4e", {13, 3406}, {1, 2}}, - {L"\U0000000d\U00000308\U00000d4e", {13, 776, 3406}, {1, 2, 3}}, - {L"\U0000000d\U00000915", {13, 2325}, {1, 2}}, - {L"\U0000000d\U00000308\U00000915", {13, 776, 2325}, {1, 2, 3}}, - {L"\U0000000d\U0000231a", {13, 8986}, {1, 2}}, - {L"\U0000000d\U00000308\U0000231a", {13, 776, 8986}, {1, 2, 3}}, - {L"\U0000000d\U00000300", {13, 768}, {1, 2}}, - {L"\U0000000d\U00000308\U00000300", {13, 776}, {1, 3}}, - {L"\U0000000d\U00000900", {13, 2304}, {1, 2}}, - {L"\U0000000d\U00000308\U00000900", {13, 776}, {1, 3}}, - {L"\U0000000d\U0000094d", {13, 2381}, {1, 2}}, - {L"\U0000000d\U00000308\U0000094d", {13, 776}, {1, 3}}, - {L"\U0000000d\U0000200d", {13, 8205}, {1, 2}}, - {L"\U0000000d\U00000308\U0000200d", {13, 776}, {1, 3}}, - {L"\U0000000d\U00000378", {13, 888}, {1, 2}}, - {L"\U0000000d\U00000308\U00000378", {13, 776, 888}, {1, 2, 3}}, - {L"\U0000000a\U00000020", {10, 32}, {1, 2}}, - {L"\U0000000a\U00000308\U00000020", {10, 776, 32}, {1, 2, 3}}, - {L"\U0000000a\U0000000d", {10, 13}, {1, 2}}, - {L"\U0000000a\U00000308\U0000000d", {10, 776, 13}, {1, 2, 3}}, - {L"\U0000000a\U0000000a", {10, 10}, {1, 2}}, - {L"\U0000000a\U00000308\U0000000a", {10, 776, 10}, {1, 2, 3}}, - {L"\U0000000a\U00000001", {10, 1}, {1, 2}}, - {L"\U0000000a\U00000308\U00000001", {10, 776, 1}, {1, 2, 3}}, - {L"\U0000000a\U0000200c", {10, 8204}, {1, 2}}, - {L"\U0000000a\U00000308\U0000200c", {10, 776}, {1, 3}}, - {L"\U0000000a\U0001f1e6", {10, 127462}, {1, 3}}, - {L"\U0000000a\U00000308\U0001f1e6", {10, 776, 127462}, {1, 2, 4}}, - {L"\U0000000a\U00000600", {10, 1536}, {1, 2}}, - {L"\U0000000a\U00000308\U00000600", {10, 776, 1536}, {1, 2, 3}}, - {L"\U0000000a\U00000a03", {10, 2563}, {1, 2}}, - {L"\U0000000a\U00000308\U00000a03", {10, 776}, {1, 3}}, - {L"\U0000000a\U00001100", {10, 4352}, {1, 2}}, - {L"\U0000000a\U00000308\U00001100", {10, 776, 4352}, {1, 2, 3}}, - {L"\U0000000a\U00001160", {10, 4448}, {1, 2}}, - {L"\U0000000a\U00000308\U00001160", {10, 776, 4448}, {1, 2, 3}}, - {L"\U0000000a\U000011a8", {10, 4520}, {1, 2}}, - {L"\U0000000a\U00000308\U000011a8", {10, 776, 4520}, {1, 2, 3}}, - {L"\U0000000a\U0000ac00", {10, 44032}, {1, 2}}, - {L"\U0000000a\U00000308\U0000ac00", {10, 776, 44032}, {1, 2, 3}}, - {L"\U0000000a\U0000ac01", {10, 44033}, {1, 2}}, - {L"\U0000000a\U00000308\U0000ac01", {10, 776, 44033}, {1, 2, 3}}, - {L"\U0000000a\U00000903", {10, 2307}, {1, 2}}, - {L"\U0000000a\U00000308\U00000903", {10, 776}, {1, 3}}, - {L"\U0000000a\U00000904", {10, 2308}, {1, 2}}, - {L"\U0000000a\U00000308\U00000904", {10, 776, 2308}, {1, 2, 3}}, - {L"\U0000000a\U00000d4e", {10, 3406}, {1, 2}}, - {L"\U0000000a\U00000308\U00000d4e", {10, 776, 3406}, {1, 2, 3}}, - {L"\U0000000a\U00000915", {10, 2325}, {1, 2}}, - {L"\U0000000a\U00000308\U00000915", {10, 776, 2325}, {1, 2, 3}}, - {L"\U0000000a\U0000231a", {10, 8986}, {1, 2}}, - {L"\U0000000a\U00000308\U0000231a", {10, 776, 8986}, {1, 2, 3}}, - {L"\U0000000a\U00000300", {10, 768}, {1, 2}}, - {L"\U0000000a\U00000308\U00000300", {10, 776}, {1, 3}}, - {L"\U0000000a\U00000900", {10, 2304}, {1, 2}}, - {L"\U0000000a\U00000308\U00000900", {10, 776}, {1, 3}}, - {L"\U0000000a\U0000094d", {10, 2381}, {1, 2}}, - {L"\U0000000a\U00000308\U0000094d", {10, 776}, {1, 3}}, - {L"\U0000000a\U0000200d", {10, 8205}, {1, 2}}, - {L"\U0000000a\U00000308\U0000200d", {10, 776}, {1, 3}}, - {L"\U0000000a\U00000378", {10, 888}, {1, 2}}, - {L"\U0000000a\U00000308\U00000378", {10, 776, 888}, {1, 2, 3}}, - {L"\U00000001\U00000020", {1, 32}, {1, 2}}, - {L"\U00000001\U00000308\U00000020", {1, 776, 32}, {1, 2, 3}}, - {L"\U00000001\U0000000d", {1, 13}, {1, 2}}, - {L"\U00000001\U00000308\U0000000d", {1, 776, 13}, {1, 2, 3}}, - {L"\U00000001\U0000000a", {1, 10}, {1, 2}}, - {L"\U00000001\U00000308\U0000000a", {1, 776, 10}, {1, 2, 3}}, - {L"\U00000001\U00000001", {1, 1}, {1, 2}}, - {L"\U00000001\U00000308\U00000001", {1, 776, 1}, {1, 2, 3}}, - {L"\U00000001\U0000200c", {1, 8204}, {1, 2}}, - {L"\U00000001\U00000308\U0000200c", {1, 776}, {1, 3}}, - {L"\U00000001\U0001f1e6", {1, 127462}, {1, 3}}, - {L"\U00000001\U00000308\U0001f1e6", {1, 776, 127462}, {1, 2, 4}}, - {L"\U00000001\U00000600", {1, 1536}, {1, 2}}, - {L"\U00000001\U00000308\U00000600", {1, 776, 1536}, {1, 2, 3}}, - {L"\U00000001\U00000a03", {1, 2563}, {1, 2}}, - {L"\U00000001\U00000308\U00000a03", {1, 776}, {1, 3}}, - {L"\U00000001\U00001100", {1, 4352}, {1, 2}}, - {L"\U00000001\U00000308\U00001100", {1, 776, 4352}, {1, 2, 3}}, - {L"\U00000001\U00001160", {1, 4448}, {1, 2}}, - {L"\U00000001\U00000308\U00001160", {1, 776, 4448}, {1, 2, 3}}, - {L"\U00000001\U000011a8", {1, 4520}, {1, 2}}, - {L"\U00000001\U00000308\U000011a8", {1, 776, 4520}, {1, 2, 3}}, - {L"\U00000001\U0000ac00", {1, 44032}, {1, 2}}, - {L"\U00000001\U00000308\U0000ac00", {1, 776, 44032}, {1, 2, 3}}, - {L"\U00000001\U0000ac01", {1, 44033}, {1, 2}}, - {L"\U00000001\U00000308\U0000ac01", {1, 776, 44033}, {1, 2, 3}}, - {L"\U00000001\U00000903", {1, 2307}, {1, 2}}, - {L"\U00000001\U00000308\U00000903", {1, 776}, {1, 3}}, - {L"\U00000001\U00000904", {1, 2308}, {1, 2}}, - {L"\U00000001\U00000308\U00000904", {1, 776, 2308}, {1, 2, 3}}, - {L"\U00000001\U00000d4e", {1, 3406}, {1, 2}}, - {L"\U00000001\U00000308\U00000d4e", {1, 776, 3406}, {1, 2, 3}}, - {L"\U00000001\U00000915", {1, 2325}, {1, 2}}, - {L"\U00000001\U00000308\U00000915", {1, 776, 2325}, {1, 2, 3}}, - {L"\U00000001\U0000231a", {1, 8986}, {1, 2}}, - {L"\U00000001\U00000308\U0000231a", {1, 776, 8986}, {1, 2, 3}}, - {L"\U00000001\U00000300", {1, 768}, {1, 2}}, - {L"\U00000001\U00000308\U00000300", {1, 776}, {1, 3}}, - {L"\U00000001\U00000900", {1, 2304}, {1, 2}}, - {L"\U00000001\U00000308\U00000900", {1, 776}, {1, 3}}, - {L"\U00000001\U0000094d", {1, 2381}, {1, 2}}, - {L"\U00000001\U00000308\U0000094d", {1, 776}, {1, 3}}, - {L"\U00000001\U0000200d", {1, 8205}, {1, 2}}, - {L"\U00000001\U00000308\U0000200d", {1, 776}, {1, 3}}, - {L"\U00000001\U00000378", {1, 888}, {1, 2}}, - {L"\U00000001\U00000308\U00000378", {1, 776, 888}, {1, 2, 3}}, - {L"\U0000200c\U00000020", {8204, 32}, {1, 2}}, - {L"\U0000200c\U00000308\U00000020", {8204, 32}, {2, 3}}, - {L"\U0000200c\U0000000d", {8204, 13}, {1, 2}}, - {L"\U0000200c\U00000308\U0000000d", {8204, 13}, {2, 3}}, - {L"\U0000200c\U0000000a", {8204, 10}, {1, 2}}, - {L"\U0000200c\U00000308\U0000000a", {8204, 10}, {2, 3}}, - {L"\U0000200c\U00000001", {8204, 1}, {1, 2}}, - {L"\U0000200c\U00000308\U00000001", {8204, 1}, {2, 3}}, - {L"\U0000200c\U0000200c", {8204}, {2}}, - {L"\U0000200c\U00000308\U0000200c", {8204}, {3}}, - {L"\U0000200c\U0001f1e6", {8204, 127462}, {1, 3}}, - {L"\U0000200c\U00000308\U0001f1e6", {8204, 127462}, {2, 4}}, - {L"\U0000200c\U00000600", {8204, 1536}, {1, 2}}, - {L"\U0000200c\U00000308\U00000600", {8204, 1536}, {2, 3}}, - {L"\U0000200c\U00000a03", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000a03", {8204}, {3}}, - {L"\U0000200c\U00001100", {8204, 4352}, {1, 2}}, - {L"\U0000200c\U00000308\U00001100", {8204, 4352}, {2, 3}}, - {L"\U0000200c\U00001160", {8204, 4448}, {1, 2}}, - {L"\U0000200c\U00000308\U00001160", {8204, 4448}, {2, 3}}, - {L"\U0000200c\U000011a8", {8204, 4520}, {1, 2}}, - {L"\U0000200c\U00000308\U000011a8", {8204, 4520}, {2, 3}}, - {L"\U0000200c\U0000ac00", {8204, 44032}, {1, 2}}, - {L"\U0000200c\U00000308\U0000ac00", {8204, 44032}, {2, 3}}, - {L"\U0000200c\U0000ac01", {8204, 44033}, {1, 2}}, - {L"\U0000200c\U00000308\U0000ac01", {8204, 44033}, {2, 3}}, - {L"\U0000200c\U00000903", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000903", {8204}, {3}}, - {L"\U0000200c\U00000904", {8204, 2308}, {1, 2}}, - {L"\U0000200c\U00000308\U00000904", {8204, 2308}, {2, 3}}, - {L"\U0000200c\U00000d4e", {8204, 3406}, {1, 2}}, - {L"\U0000200c\U00000308\U00000d4e", {8204, 3406}, {2, 3}}, - {L"\U0000200c\U00000915", {8204, 2325}, {1, 2}}, - {L"\U0000200c\U00000308\U00000915", {8204, 2325}, {2, 3}}, - {L"\U0000200c\U0000231a", {8204, 8986}, {1, 2}}, - {L"\U0000200c\U00000308\U0000231a", {8204, 8986}, {2, 3}}, - {L"\U0000200c\U00000300", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000300", {8204}, {3}}, - {L"\U0000200c\U00000900", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000900", {8204}, {3}}, - {L"\U0000200c\U0000094d", {8204}, {2}}, - {L"\U0000200c\U00000308\U0000094d", {8204}, {3}}, - {L"\U0000200c\U0000200d", {8204}, {2}}, - {L"\U0000200c\U00000308\U0000200d", {8204}, {3}}, - {L"\U0000200c\U00000378", {8204, 888}, {1, 2}}, - {L"\U0000200c\U00000308\U00000378", {8204, 888}, {2, 3}}, - {L"\U0001f1e6\U00000020", {127462, 32}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000020", {127462, 32}, {3, 4}}, - {L"\U0001f1e6\U0000000d", {127462, 13}, {2, 3}}, - {L"\U0001f1e6\U00000308\U0000000d", {127462, 13}, {3, 4}}, - {L"\U0001f1e6\U0000000a", {127462, 10}, {2, 3}}, - {L"\U0001f1e6\U00000308\U0000000a", {127462, 10}, {3, 4}}, - {L"\U0001f1e6\U00000001", {127462, 1}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000001", {127462, 1}, {3, 4}}, - {L"\U0001f1e6\U0000200c", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U0000200c", {127462}, {4}}, - {L"\U0001f1e6\U0001f1e6", {127462}, {4}}, - {L"\U0001f1e6\U00000308\U0001f1e6", {127462, 127462}, {3, 5}}, - {L"\U0001f1e6\U00000600", {127462, 1536}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000600", {127462, 1536}, {3, 4}}, - {L"\U0001f1e6\U00000a03", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U00000a03", {127462}, {4}}, - {L"\U0001f1e6\U00001100", {127462, 4352}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00001100", {127462, 4352}, {3, 4}}, - {L"\U0001f1e6\U00001160", {127462, 4448}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00001160", {127462, 4448}, {3, 4}}, - {L"\U0001f1e6\U000011a8", {127462, 4520}, {2, 3}}, - {L"\U0001f1e6\U00000308\U000011a8", {127462, 4520}, {3, 4}}, - {L"\U0001f1e6\U0000ac00", {127462, 44032}, {2, 3}}, - {L"\U0001f1e6\U00000308\U0000ac00", {127462, 44032}, {3, 4}}, - {L"\U0001f1e6\U0000ac01", {127462, 44033}, {2, 3}}, - {L"\U0001f1e6\U00000308\U0000ac01", {127462, 44033}, {3, 4}}, - {L"\U0001f1e6\U00000903", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U00000903", {127462}, {4}}, - {L"\U0001f1e6\U00000904", {127462, 2308}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000904", {127462, 2308}, {3, 4}}, - {L"\U0001f1e6\U00000d4e", {127462, 3406}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000d4e", {127462, 3406}, {3, 4}}, - {L"\U0001f1e6\U00000915", {127462, 2325}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000915", {127462, 2325}, {3, 4}}, - {L"\U0001f1e6\U0000231a", {127462, 8986}, {2, 3}}, - {L"\U0001f1e6\U00000308\U0000231a", {127462, 8986}, {3, 4}}, - {L"\U0001f1e6\U00000300", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U00000300", {127462}, {4}}, - {L"\U0001f1e6\U00000900", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U00000900", {127462}, {4}}, - {L"\U0001f1e6\U0000094d", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U0000094d", {127462}, {4}}, - {L"\U0001f1e6\U0000200d", {127462}, {3}}, - {L"\U0001f1e6\U00000308\U0000200d", {127462}, {4}}, - {L"\U0001f1e6\U00000378", {127462, 888}, {2, 3}}, - {L"\U0001f1e6\U00000308\U00000378", {127462, 888}, {3, 4}}, - {L"\U00000600\U00000020", {1536}, {2}}, - {L"\U00000600\U00000308\U00000020", {1536, 32}, {2, 3}}, - {L"\U00000600\U0000000d", {1536, 13}, {1, 2}}, - {L"\U00000600\U00000308\U0000000d", {1536, 13}, {2, 3}}, - {L"\U00000600\U0000000a", {1536, 10}, {1, 2}}, - {L"\U00000600\U00000308\U0000000a", {1536, 10}, {2, 3}}, - {L"\U00000600\U00000001", {1536, 1}, {1, 2}}, - {L"\U00000600\U00000308\U00000001", {1536, 1}, {2, 3}}, - {L"\U00000600\U0000200c", {1536}, {2}}, - {L"\U00000600\U00000308\U0000200c", {1536}, {3}}, - {L"\U00000600\U0001f1e6", {1536}, {3}}, - {L"\U00000600\U00000308\U0001f1e6", {1536, 127462}, {2, 4}}, - {L"\U00000600\U00000600", {1536}, {2}}, - {L"\U00000600\U00000308\U00000600", {1536, 1536}, {2, 3}}, - {L"\U00000600\U00000a03", {1536}, {2}}, - {L"\U00000600\U00000308\U00000a03", {1536}, {3}}, - {L"\U00000600\U00001100", {1536}, {2}}, - {L"\U00000600\U00000308\U00001100", {1536, 4352}, {2, 3}}, - {L"\U00000600\U00001160", {1536}, {2}}, - {L"\U00000600\U00000308\U00001160", {1536, 4448}, {2, 3}}, - {L"\U00000600\U000011a8", {1536}, {2}}, - {L"\U00000600\U00000308\U000011a8", {1536, 4520}, {2, 3}}, - {L"\U00000600\U0000ac00", {1536}, {2}}, - {L"\U00000600\U00000308\U0000ac00", {1536, 44032}, {2, 3}}, - {L"\U00000600\U0000ac01", {1536}, {2}}, - {L"\U00000600\U00000308\U0000ac01", {1536, 44033}, {2, 3}}, - {L"\U00000600\U00000903", {1536}, {2}}, - {L"\U00000600\U00000308\U00000903", {1536}, {3}}, - {L"\U00000600\U00000904", {1536}, {2}}, - {L"\U00000600\U00000308\U00000904", {1536, 2308}, {2, 3}}, - {L"\U00000600\U00000d4e", {1536}, {2}}, - {L"\U00000600\U00000308\U00000d4e", {1536, 3406}, {2, 3}}, - {L"\U00000600\U00000915", {1536}, {2}}, - {L"\U00000600\U00000308\U00000915", {1536, 2325}, {2, 3}}, - {L"\U00000600\U0000231a", {1536}, {2}}, - {L"\U00000600\U00000308\U0000231a", {1536, 8986}, {2, 3}}, - {L"\U00000600\U00000300", {1536}, {2}}, - {L"\U00000600\U00000308\U00000300", {1536}, {3}}, - {L"\U00000600\U00000900", {1536}, {2}}, - {L"\U00000600\U00000308\U00000900", {1536}, {3}}, - {L"\U00000600\U0000094d", {1536}, {2}}, - {L"\U00000600\U00000308\U0000094d", {1536}, {3}}, - {L"\U00000600\U0000200d", {1536}, {2}}, - {L"\U00000600\U00000308\U0000200d", {1536}, {3}}, - {L"\U00000600\U00000378", {1536}, {2}}, - {L"\U00000600\U00000308\U00000378", {1536, 888}, {2, 3}}, - {L"\U00000a03\U00000020", {2563, 32}, {1, 2}}, - {L"\U00000a03\U00000308\U00000020", {2563, 32}, {2, 3}}, - {L"\U00000a03\U0000000d", {2563, 13}, {1, 2}}, - {L"\U00000a03\U00000308\U0000000d", {2563, 13}, {2, 3}}, - {L"\U00000a03\U0000000a", {2563, 10}, {1, 2}}, - {L"\U00000a03\U00000308\U0000000a", {2563, 10}, {2, 3}}, - {L"\U00000a03\U00000001", {2563, 1}, {1, 2}}, - {L"\U00000a03\U00000308\U00000001", {2563, 1}, {2, 3}}, - {L"\U00000a03\U0000200c", {2563}, {2}}, - {L"\U00000a03\U00000308\U0000200c", {2563}, {3}}, - {L"\U00000a03\U0001f1e6", {2563, 127462}, {1, 3}}, - {L"\U00000a03\U00000308\U0001f1e6", {2563, 127462}, {2, 4}}, - {L"\U00000a03\U00000600", {2563, 1536}, {1, 2}}, - {L"\U00000a03\U00000308\U00000600", {2563, 1536}, {2, 3}}, - {L"\U00000a03\U00000a03", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000a03", {2563}, {3}}, - {L"\U00000a03\U00001100", {2563, 4352}, {1, 2}}, - {L"\U00000a03\U00000308\U00001100", {2563, 4352}, {2, 3}}, - {L"\U00000a03\U00001160", {2563, 4448}, {1, 2}}, - {L"\U00000a03\U00000308\U00001160", {2563, 4448}, {2, 3}}, - {L"\U00000a03\U000011a8", {2563, 4520}, {1, 2}}, - {L"\U00000a03\U00000308\U000011a8", {2563, 4520}, {2, 3}}, - {L"\U00000a03\U0000ac00", {2563, 44032}, {1, 2}}, - {L"\U00000a03\U00000308\U0000ac00", {2563, 44032}, {2, 3}}, - {L"\U00000a03\U0000ac01", {2563, 44033}, {1, 2}}, - {L"\U00000a03\U00000308\U0000ac01", {2563, 44033}, {2, 3}}, - {L"\U00000a03\U00000903", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000903", {2563}, {3}}, - {L"\U00000a03\U00000904", {2563, 2308}, {1, 2}}, - {L"\U00000a03\U00000308\U00000904", {2563, 2308}, {2, 3}}, - {L"\U00000a03\U00000d4e", {2563, 3406}, {1, 2}}, - {L"\U00000a03\U00000308\U00000d4e", {2563, 3406}, {2, 3}}, - {L"\U00000a03\U00000915", {2563, 2325}, {1, 2}}, - {L"\U00000a03\U00000308\U00000915", {2563, 2325}, {2, 3}}, - {L"\U00000a03\U0000231a", {2563, 8986}, {1, 2}}, - {L"\U00000a03\U00000308\U0000231a", {2563, 8986}, {2, 3}}, - {L"\U00000a03\U00000300", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000300", {2563}, {3}}, - {L"\U00000a03\U00000900", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000900", {2563}, {3}}, - {L"\U00000a03\U0000094d", {2563}, {2}}, - {L"\U00000a03\U00000308\U0000094d", {2563}, {3}}, - {L"\U00000a03\U0000200d", {2563}, {2}}, - {L"\U00000a03\U00000308\U0000200d", {2563}, {3}}, - {L"\U00000a03\U00000378", {2563, 888}, {1, 2}}, - {L"\U00000a03\U00000308\U00000378", {2563, 888}, {2, 3}}, - {L"\U00001100\U00000020", {4352, 32}, {1, 2}}, - {L"\U00001100\U00000308\U00000020", {4352, 32}, {2, 3}}, - {L"\U00001100\U0000000d", {4352, 13}, {1, 2}}, - {L"\U00001100\U00000308\U0000000d", {4352, 13}, {2, 3}}, - {L"\U00001100\U0000000a", {4352, 10}, {1, 2}}, - {L"\U00001100\U00000308\U0000000a", {4352, 10}, {2, 3}}, - {L"\U00001100\U00000001", {4352, 1}, {1, 2}}, - {L"\U00001100\U00000308\U00000001", {4352, 1}, {2, 3}}, - {L"\U00001100\U0000200c", {4352}, {2}}, - {L"\U00001100\U00000308\U0000200c", {4352}, {3}}, - {L"\U00001100\U0001f1e6", {4352, 127462}, {1, 3}}, - {L"\U00001100\U00000308\U0001f1e6", {4352, 127462}, {2, 4}}, - {L"\U00001100\U00000600", {4352, 1536}, {1, 2}}, - {L"\U00001100\U00000308\U00000600", {4352, 1536}, {2, 3}}, - {L"\U00001100\U00000a03", {4352}, {2}}, - {L"\U00001100\U00000308\U00000a03", {4352}, {3}}, - {L"\U00001100\U00001100", {4352}, {2}}, - {L"\U00001100\U00000308\U00001100", {4352, 4352}, {2, 3}}, - {L"\U00001100\U00001160", {4352}, {2}}, - {L"\U00001100\U00000308\U00001160", {4352, 4448}, {2, 3}}, - {L"\U00001100\U000011a8", {4352, 4520}, {1, 2}}, - {L"\U00001100\U00000308\U000011a8", {4352, 4520}, {2, 3}}, - {L"\U00001100\U0000ac00", {4352}, {2}}, - {L"\U00001100\U00000308\U0000ac00", {4352, 44032}, {2, 3}}, - {L"\U00001100\U0000ac01", {4352}, {2}}, - {L"\U00001100\U00000308\U0000ac01", {4352, 44033}, {2, 3}}, - {L"\U00001100\U00000903", {4352}, {2}}, - {L"\U00001100\U00000308\U00000903", {4352}, {3}}, - {L"\U00001100\U00000904", {4352, 2308}, {1, 2}}, - {L"\U00001100\U00000308\U00000904", {4352, 2308}, {2, 3}}, - {L"\U00001100\U00000d4e", {4352, 3406}, {1, 2}}, - {L"\U00001100\U00000308\U00000d4e", {4352, 3406}, {2, 3}}, - {L"\U00001100\U00000915", {4352, 2325}, {1, 2}}, - {L"\U00001100\U00000308\U00000915", {4352, 2325}, {2, 3}}, - {L"\U00001100\U0000231a", {4352, 8986}, {1, 2}}, - {L"\U00001100\U00000308\U0000231a", {4352, 8986}, {2, 3}}, - {L"\U00001100\U00000300", {4352}, {2}}, - {L"\U00001100\U00000308\U00000300", {4352}, {3}}, - {L"\U00001100\U00000900", {4352}, {2}}, - {L"\U00001100\U00000308\U00000900", {4352}, {3}}, - {L"\U00001100\U0000094d", {4352}, {2}}, - {L"\U00001100\U00000308\U0000094d", {4352}, {3}}, - {L"\U00001100\U0000200d", {4352}, {2}}, - {L"\U00001100\U00000308\U0000200d", {4352}, {3}}, - {L"\U00001100\U00000378", {4352, 888}, {1, 2}}, - {L"\U00001100\U00000308\U00000378", {4352, 888}, {2, 3}}, - {L"\U00001160\U00000020", {4448, 32}, {1, 2}}, - {L"\U00001160\U00000308\U00000020", {4448, 32}, {2, 3}}, - {L"\U00001160\U0000000d", {4448, 13}, {1, 2}}, - {L"\U00001160\U00000308\U0000000d", {4448, 13}, {2, 3}}, - {L"\U00001160\U0000000a", {4448, 10}, {1, 2}}, - {L"\U00001160\U00000308\U0000000a", {4448, 10}, {2, 3}}, - {L"\U00001160\U00000001", {4448, 1}, {1, 2}}, - {L"\U00001160\U00000308\U00000001", {4448, 1}, {2, 3}}, - {L"\U00001160\U0000200c", {4448}, {2}}, - {L"\U00001160\U00000308\U0000200c", {4448}, {3}}, - {L"\U00001160\U0001f1e6", {4448, 127462}, {1, 3}}, - {L"\U00001160\U00000308\U0001f1e6", {4448, 127462}, {2, 4}}, - {L"\U00001160\U00000600", {4448, 1536}, {1, 2}}, - {L"\U00001160\U00000308\U00000600", {4448, 1536}, {2, 3}}, - {L"\U00001160\U00000a03", {4448}, {2}}, - {L"\U00001160\U00000308\U00000a03", {4448}, {3}}, - {L"\U00001160\U00001100", {4448, 4352}, {1, 2}}, - {L"\U00001160\U00000308\U00001100", {4448, 4352}, {2, 3}}, - {L"\U00001160\U00001160", {4448}, {2}}, - {L"\U00001160\U00000308\U00001160", {4448, 4448}, {2, 3}}, - {L"\U00001160\U000011a8", {4448}, {2}}, - {L"\U00001160\U00000308\U000011a8", {4448, 4520}, {2, 3}}, - {L"\U00001160\U0000ac00", {4448, 44032}, {1, 2}}, - {L"\U00001160\U00000308\U0000ac00", {4448, 44032}, {2, 3}}, - {L"\U00001160\U0000ac01", {4448, 44033}, {1, 2}}, - {L"\U00001160\U00000308\U0000ac01", {4448, 44033}, {2, 3}}, - {L"\U00001160\U00000903", {4448}, {2}}, - {L"\U00001160\U00000308\U00000903", {4448}, {3}}, - {L"\U00001160\U00000904", {4448, 2308}, {1, 2}}, - {L"\U00001160\U00000308\U00000904", {4448, 2308}, {2, 3}}, - {L"\U00001160\U00000d4e", {4448, 3406}, {1, 2}}, - {L"\U00001160\U00000308\U00000d4e", {4448, 3406}, {2, 3}}, - {L"\U00001160\U00000915", {4448, 2325}, {1, 2}}, - {L"\U00001160\U00000308\U00000915", {4448, 2325}, {2, 3}}, - {L"\U00001160\U0000231a", {4448, 8986}, {1, 2}}, - {L"\U00001160\U00000308\U0000231a", {4448, 8986}, {2, 3}}, - {L"\U00001160\U00000300", {4448}, {2}}, - {L"\U00001160\U00000308\U00000300", {4448}, {3}}, - {L"\U00001160\U00000900", {4448}, {2}}, - {L"\U00001160\U00000308\U00000900", {4448}, {3}}, - {L"\U00001160\U0000094d", {4448}, {2}}, - {L"\U00001160\U00000308\U0000094d", {4448}, {3}}, - {L"\U00001160\U0000200d", {4448}, {2}}, - {L"\U00001160\U00000308\U0000200d", {4448}, {3}}, - {L"\U00001160\U00000378", {4448, 888}, {1, 2}}, - {L"\U00001160\U00000308\U00000378", {4448, 888}, {2, 3}}, - {L"\U000011a8\U00000020", {4520, 32}, {1, 2}}, - {L"\U000011a8\U00000308\U00000020", {4520, 32}, {2, 3}}, - {L"\U000011a8\U0000000d", {4520, 13}, {1, 2}}, - {L"\U000011a8\U00000308\U0000000d", {4520, 13}, {2, 3}}, - {L"\U000011a8\U0000000a", {4520, 10}, {1, 2}}, - {L"\U000011a8\U00000308\U0000000a", {4520, 10}, {2, 3}}, - {L"\U000011a8\U00000001", {4520, 1}, {1, 2}}, - {L"\U000011a8\U00000308\U00000001", {4520, 1}, {2, 3}}, - {L"\U000011a8\U0000200c", {4520}, {2}}, - {L"\U000011a8\U00000308\U0000200c", {4520}, {3}}, - {L"\U000011a8\U0001f1e6", {4520, 127462}, {1, 3}}, - {L"\U000011a8\U00000308\U0001f1e6", {4520, 127462}, {2, 4}}, - {L"\U000011a8\U00000600", {4520, 1536}, {1, 2}}, - {L"\U000011a8\U00000308\U00000600", {4520, 1536}, {2, 3}}, - {L"\U000011a8\U00000a03", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000a03", {4520}, {3}}, - {L"\U000011a8\U00001100", {4520, 4352}, {1, 2}}, - {L"\U000011a8\U00000308\U00001100", {4520, 4352}, {2, 3}}, - {L"\U000011a8\U00001160", {4520, 4448}, {1, 2}}, - {L"\U000011a8\U00000308\U00001160", {4520, 4448}, {2, 3}}, - {L"\U000011a8\U000011a8", {4520}, {2}}, - {L"\U000011a8\U00000308\U000011a8", {4520, 4520}, {2, 3}}, - {L"\U000011a8\U0000ac00", {4520, 44032}, {1, 2}}, - {L"\U000011a8\U00000308\U0000ac00", {4520, 44032}, {2, 3}}, - {L"\U000011a8\U0000ac01", {4520, 44033}, {1, 2}}, - {L"\U000011a8\U00000308\U0000ac01", {4520, 44033}, {2, 3}}, - {L"\U000011a8\U00000903", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000903", {4520}, {3}}, - {L"\U000011a8\U00000904", {4520, 2308}, {1, 2}}, - {L"\U000011a8\U00000308\U00000904", {4520, 2308}, {2, 3}}, - {L"\U000011a8\U00000d4e", {4520, 3406}, {1, 2}}, - {L"\U000011a8\U00000308\U00000d4e", {4520, 3406}, {2, 3}}, - {L"\U000011a8\U00000915", {4520, 2325}, {1, 2}}, - {L"\U000011a8\U00000308\U00000915", {4520, 2325}, {2, 3}}, - {L"\U000011a8\U0000231a", {4520, 8986}, {1, 2}}, - {L"\U000011a8\U00000308\U0000231a", {4520, 8986}, {2, 3}}, - {L"\U000011a8\U00000300", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000300", {4520}, {3}}, - {L"\U000011a8\U00000900", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000900", {4520}, {3}}, - {L"\U000011a8\U0000094d", {4520}, {2}}, - {L"\U000011a8\U00000308\U0000094d", {4520}, {3}}, - {L"\U000011a8\U0000200d", {4520}, {2}}, - {L"\U000011a8\U00000308\U0000200d", {4520}, {3}}, - {L"\U000011a8\U00000378", {4520, 888}, {1, 2}}, - {L"\U000011a8\U00000308\U00000378", {4520, 888}, {2, 3}}, - {L"\U0000ac00\U00000020", {44032, 32}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000020", {44032, 32}, {2, 3}}, - {L"\U0000ac00\U0000000d", {44032, 13}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000000d", {44032, 13}, {2, 3}}, - {L"\U0000ac00\U0000000a", {44032, 10}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000000a", {44032, 10}, {2, 3}}, - {L"\U0000ac00\U00000001", {44032, 1}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000001", {44032, 1}, {2, 3}}, - {L"\U0000ac00\U0000200c", {44032}, {2}}, - {L"\U0000ac00\U00000308\U0000200c", {44032}, {3}}, - {L"\U0000ac00\U0001f1e6", {44032, 127462}, {1, 3}}, - {L"\U0000ac00\U00000308\U0001f1e6", {44032, 127462}, {2, 4}}, - {L"\U0000ac00\U00000600", {44032, 1536}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000600", {44032, 1536}, {2, 3}}, - {L"\U0000ac00\U00000a03", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000a03", {44032}, {3}}, - {L"\U0000ac00\U00001100", {44032, 4352}, {1, 2}}, - {L"\U0000ac00\U00000308\U00001100", {44032, 4352}, {2, 3}}, - {L"\U0000ac00\U00001160", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00001160", {44032, 4448}, {2, 3}}, - {L"\U0000ac00\U000011a8", {44032}, {2}}, - {L"\U0000ac00\U00000308\U000011a8", {44032, 4520}, {2, 3}}, - {L"\U0000ac00\U0000ac00", {44032, 44032}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000ac00", {44032, 44032}, {2, 3}}, - {L"\U0000ac00\U0000ac01", {44032, 44033}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000ac01", {44032, 44033}, {2, 3}}, - {L"\U0000ac00\U00000903", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000903", {44032}, {3}}, - {L"\U0000ac00\U00000904", {44032, 2308}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000904", {44032, 2308}, {2, 3}}, - {L"\U0000ac00\U00000d4e", {44032, 3406}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000d4e", {44032, 3406}, {2, 3}}, - {L"\U0000ac00\U00000915", {44032, 2325}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000915", {44032, 2325}, {2, 3}}, - {L"\U0000ac00\U0000231a", {44032, 8986}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000231a", {44032, 8986}, {2, 3}}, - {L"\U0000ac00\U00000300", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000300", {44032}, {3}}, - {L"\U0000ac00\U00000900", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000900", {44032}, {3}}, - {L"\U0000ac00\U0000094d", {44032}, {2}}, - {L"\U0000ac00\U00000308\U0000094d", {44032}, {3}}, - {L"\U0000ac00\U0000200d", {44032}, {2}}, - {L"\U0000ac00\U00000308\U0000200d", {44032}, {3}}, - {L"\U0000ac00\U00000378", {44032, 888}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000378", {44032, 888}, {2, 3}}, - {L"\U0000ac01\U00000020", {44033, 32}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000020", {44033, 32}, {2, 3}}, - {L"\U0000ac01\U0000000d", {44033, 13}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000000d", {44033, 13}, {2, 3}}, - {L"\U0000ac01\U0000000a", {44033, 10}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000000a", {44033, 10}, {2, 3}}, - {L"\U0000ac01\U00000001", {44033, 1}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000001", {44033, 1}, {2, 3}}, - {L"\U0000ac01\U0000200c", {44033}, {2}}, - {L"\U0000ac01\U00000308\U0000200c", {44033}, {3}}, - {L"\U0000ac01\U0001f1e6", {44033, 127462}, {1, 3}}, - {L"\U0000ac01\U00000308\U0001f1e6", {44033, 127462}, {2, 4}}, - {L"\U0000ac01\U00000600", {44033, 1536}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000600", {44033, 1536}, {2, 3}}, - {L"\U0000ac01\U00000a03", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000a03", {44033}, {3}}, - {L"\U0000ac01\U00001100", {44033, 4352}, {1, 2}}, - {L"\U0000ac01\U00000308\U00001100", {44033, 4352}, {2, 3}}, - {L"\U0000ac01\U00001160", {44033, 4448}, {1, 2}}, - {L"\U0000ac01\U00000308\U00001160", {44033, 4448}, {2, 3}}, - {L"\U0000ac01\U000011a8", {44033}, {2}}, - {L"\U0000ac01\U00000308\U000011a8", {44033, 4520}, {2, 3}}, - {L"\U0000ac01\U0000ac00", {44033, 44032}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000ac00", {44033, 44032}, {2, 3}}, - {L"\U0000ac01\U0000ac01", {44033, 44033}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000ac01", {44033, 44033}, {2, 3}}, - {L"\U0000ac01\U00000903", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000903", {44033}, {3}}, - {L"\U0000ac01\U00000904", {44033, 2308}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000904", {44033, 2308}, {2, 3}}, - {L"\U0000ac01\U00000d4e", {44033, 3406}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000d4e", {44033, 3406}, {2, 3}}, - {L"\U0000ac01\U00000915", {44033, 2325}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000915", {44033, 2325}, {2, 3}}, - {L"\U0000ac01\U0000231a", {44033, 8986}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000231a", {44033, 8986}, {2, 3}}, - {L"\U0000ac01\U00000300", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000300", {44033}, {3}}, - {L"\U0000ac01\U00000900", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000900", {44033}, {3}}, - {L"\U0000ac01\U0000094d", {44033}, {2}}, - {L"\U0000ac01\U00000308\U0000094d", {44033}, {3}}, - {L"\U0000ac01\U0000200d", {44033}, {2}}, - {L"\U0000ac01\U00000308\U0000200d", {44033}, {3}}, - {L"\U0000ac01\U00000378", {44033, 888}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000378", {44033, 888}, {2, 3}}, - {L"\U00000903\U00000020", {2307, 32}, {1, 2}}, - {L"\U00000903\U00000308\U00000020", {2307, 32}, {2, 3}}, - {L"\U00000903\U0000000d", {2307, 13}, {1, 2}}, - {L"\U00000903\U00000308\U0000000d", {2307, 13}, {2, 3}}, - {L"\U00000903\U0000000a", {2307, 10}, {1, 2}}, - {L"\U00000903\U00000308\U0000000a", {2307, 10}, {2, 3}}, - {L"\U00000903\U00000001", {2307, 1}, {1, 2}}, - {L"\U00000903\U00000308\U00000001", {2307, 1}, {2, 3}}, - {L"\U00000903\U0000200c", {2307}, {2}}, - {L"\U00000903\U00000308\U0000200c", {2307}, {3}}, - {L"\U00000903\U0001f1e6", {2307, 127462}, {1, 3}}, - {L"\U00000903\U00000308\U0001f1e6", {2307, 127462}, {2, 4}}, - {L"\U00000903\U00000600", {2307, 1536}, {1, 2}}, - {L"\U00000903\U00000308\U00000600", {2307, 1536}, {2, 3}}, - {L"\U00000903\U00000a03", {2307}, {2}}, - {L"\U00000903\U00000308\U00000a03", {2307}, {3}}, - {L"\U00000903\U00001100", {2307, 4352}, {1, 2}}, - {L"\U00000903\U00000308\U00001100", {2307, 4352}, {2, 3}}, - {L"\U00000903\U00001160", {2307, 4448}, {1, 2}}, - {L"\U00000903\U00000308\U00001160", {2307, 4448}, {2, 3}}, - {L"\U00000903\U000011a8", {2307, 4520}, {1, 2}}, - {L"\U00000903\U00000308\U000011a8", {2307, 4520}, {2, 3}}, - {L"\U00000903\U0000ac00", {2307, 44032}, {1, 2}}, - {L"\U00000903\U00000308\U0000ac00", {2307, 44032}, {2, 3}}, - {L"\U00000903\U0000ac01", {2307, 44033}, {1, 2}}, - {L"\U00000903\U00000308\U0000ac01", {2307, 44033}, {2, 3}}, - {L"\U00000903\U00000903", {2307}, {2}}, - {L"\U00000903\U00000308\U00000903", {2307}, {3}}, - {L"\U00000903\U00000904", {2307, 2308}, {1, 2}}, - {L"\U00000903\U00000308\U00000904", {2307, 2308}, {2, 3}}, - {L"\U00000903\U00000d4e", {2307, 3406}, {1, 2}}, - {L"\U00000903\U00000308\U00000d4e", {2307, 3406}, {2, 3}}, - {L"\U00000903\U00000915", {2307, 2325}, {1, 2}}, - {L"\U00000903\U00000308\U00000915", {2307, 2325}, {2, 3}}, - {L"\U00000903\U0000231a", {2307, 8986}, {1, 2}}, - {L"\U00000903\U00000308\U0000231a", {2307, 8986}, {2, 3}}, - {L"\U00000903\U00000300", {2307}, {2}}, - {L"\U00000903\U00000308\U00000300", {2307}, {3}}, - {L"\U00000903\U00000900", {2307}, {2}}, - {L"\U00000903\U00000308\U00000900", {2307}, {3}}, - {L"\U00000903\U0000094d", {2307}, {2}}, - {L"\U00000903\U00000308\U0000094d", {2307}, {3}}, - {L"\U00000903\U0000200d", {2307}, {2}}, - {L"\U00000903\U00000308\U0000200d", {2307}, {3}}, - {L"\U00000903\U00000378", {2307, 888}, {1, 2}}, - {L"\U00000903\U00000308\U00000378", {2307, 888}, {2, 3}}, - {L"\U00000904\U00000020", {2308, 32}, {1, 2}}, - {L"\U00000904\U00000308\U00000020", {2308, 32}, {2, 3}}, - {L"\U00000904\U0000000d", {2308, 13}, {1, 2}}, - {L"\U00000904\U00000308\U0000000d", {2308, 13}, {2, 3}}, - {L"\U00000904\U0000000a", {2308, 10}, {1, 2}}, - {L"\U00000904\U00000308\U0000000a", {2308, 10}, {2, 3}}, - {L"\U00000904\U00000001", {2308, 1}, {1, 2}}, - {L"\U00000904\U00000308\U00000001", {2308, 1}, {2, 3}}, - {L"\U00000904\U0000200c", {2308}, {2}}, - {L"\U00000904\U00000308\U0000200c", {2308}, {3}}, - {L"\U00000904\U0001f1e6", {2308, 127462}, {1, 3}}, - {L"\U00000904\U00000308\U0001f1e6", {2308, 127462}, {2, 4}}, - {L"\U00000904\U00000600", {2308, 1536}, {1, 2}}, - {L"\U00000904\U00000308\U00000600", {2308, 1536}, {2, 3}}, - {L"\U00000904\U00000a03", {2308}, {2}}, - {L"\U00000904\U00000308\U00000a03", {2308}, {3}}, - {L"\U00000904\U00001100", {2308, 4352}, {1, 2}}, - {L"\U00000904\U00000308\U00001100", {2308, 4352}, {2, 3}}, - {L"\U00000904\U00001160", {2308, 4448}, {1, 2}}, - {L"\U00000904\U00000308\U00001160", {2308, 4448}, {2, 3}}, - {L"\U00000904\U000011a8", {2308, 4520}, {1, 2}}, - {L"\U00000904\U00000308\U000011a8", {2308, 4520}, {2, 3}}, - {L"\U00000904\U0000ac00", {2308, 44032}, {1, 2}}, - {L"\U00000904\U00000308\U0000ac00", {2308, 44032}, {2, 3}}, - {L"\U00000904\U0000ac01", {2308, 44033}, {1, 2}}, - {L"\U00000904\U00000308\U0000ac01", {2308, 44033}, {2, 3}}, - {L"\U00000904\U00000903", {2308}, {2}}, - {L"\U00000904\U00000308\U00000903", {2308}, {3}}, - {L"\U00000904\U00000904", {2308, 2308}, {1, 2}}, - {L"\U00000904\U00000308\U00000904", {2308, 2308}, {2, 3}}, - {L"\U00000904\U00000d4e", {2308, 3406}, {1, 2}}, - {L"\U00000904\U00000308\U00000d4e", {2308, 3406}, {2, 3}}, - {L"\U00000904\U00000915", {2308, 2325}, {1, 2}}, - {L"\U00000904\U00000308\U00000915", {2308, 2325}, {2, 3}}, - {L"\U00000904\U0000231a", {2308, 8986}, {1, 2}}, - {L"\U00000904\U00000308\U0000231a", {2308, 8986}, {2, 3}}, - {L"\U00000904\U00000300", {2308}, {2}}, - {L"\U00000904\U00000308\U00000300", {2308}, {3}}, - {L"\U00000904\U00000900", {2308}, {2}}, - {L"\U00000904\U00000308\U00000900", {2308}, {3}}, - {L"\U00000904\U0000094d", {2308}, {2}}, - {L"\U00000904\U00000308\U0000094d", {2308}, {3}}, - {L"\U00000904\U0000200d", {2308}, {2}}, - {L"\U00000904\U00000308\U0000200d", {2308}, {3}}, - {L"\U00000904\U00000378", {2308, 888}, {1, 2}}, - {L"\U00000904\U00000308\U00000378", {2308, 888}, {2, 3}}, - {L"\U00000d4e\U00000020", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000020", {3406, 32}, {2, 3}}, - {L"\U00000d4e\U0000000d", {3406, 13}, {1, 2}}, - {L"\U00000d4e\U00000308\U0000000d", {3406, 13}, {2, 3}}, - {L"\U00000d4e\U0000000a", {3406, 10}, {1, 2}}, - {L"\U00000d4e\U00000308\U0000000a", {3406, 10}, {2, 3}}, - {L"\U00000d4e\U00000001", {3406, 1}, {1, 2}}, - {L"\U00000d4e\U00000308\U00000001", {3406, 1}, {2, 3}}, - {L"\U00000d4e\U0000200c", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000200c", {3406}, {3}}, - {L"\U00000d4e\U0001f1e6", {3406}, {3}}, - {L"\U00000d4e\U00000308\U0001f1e6", {3406, 127462}, {2, 4}}, - {L"\U00000d4e\U00000600", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000600", {3406, 1536}, {2, 3}}, - {L"\U00000d4e\U00000a03", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000a03", {3406}, {3}}, - {L"\U00000d4e\U00001100", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00001100", {3406, 4352}, {2, 3}}, - {L"\U00000d4e\U00001160", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00001160", {3406, 4448}, {2, 3}}, - {L"\U00000d4e\U000011a8", {3406}, {2}}, - {L"\U00000d4e\U00000308\U000011a8", {3406, 4520}, {2, 3}}, - {L"\U00000d4e\U0000ac00", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000ac00", {3406, 44032}, {2, 3}}, - {L"\U00000d4e\U0000ac01", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000ac01", {3406, 44033}, {2, 3}}, - {L"\U00000d4e\U00000903", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000903", {3406}, {3}}, - {L"\U00000d4e\U00000904", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000904", {3406, 2308}, {2, 3}}, - {L"\U00000d4e\U00000d4e", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000d4e", {3406, 3406}, {2, 3}}, - {L"\U00000d4e\U00000915", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000915", {3406, 2325}, {2, 3}}, - {L"\U00000d4e\U0000231a", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000231a", {3406, 8986}, {2, 3}}, - {L"\U00000d4e\U00000300", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000300", {3406}, {3}}, - {L"\U00000d4e\U00000900", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000900", {3406}, {3}}, - {L"\U00000d4e\U0000094d", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000094d", {3406}, {3}}, - {L"\U00000d4e\U0000200d", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000200d", {3406}, {3}}, - {L"\U00000d4e\U00000378", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000378", {3406, 888}, {2, 3}}, - {L"\U00000915\U00000020", {2325, 32}, {1, 2}}, - {L"\U00000915\U00000308\U00000020", {2325, 32}, {2, 3}}, - {L"\U00000915\U0000000d", {2325, 13}, {1, 2}}, - {L"\U00000915\U00000308\U0000000d", {2325, 13}, {2, 3}}, - {L"\U00000915\U0000000a", {2325, 10}, {1, 2}}, - {L"\U00000915\U00000308\U0000000a", {2325, 10}, {2, 3}}, - {L"\U00000915\U00000001", {2325, 1}, {1, 2}}, - {L"\U00000915\U00000308\U00000001", {2325, 1}, {2, 3}}, - {L"\U00000915\U0000200c", {2325}, {2}}, - {L"\U00000915\U00000308\U0000200c", {2325}, {3}}, - {L"\U00000915\U0001f1e6", {2325, 127462}, {1, 3}}, - {L"\U00000915\U00000308\U0001f1e6", {2325, 127462}, {2, 4}}, - {L"\U00000915\U00000600", {2325, 1536}, {1, 2}}, - {L"\U00000915\U00000308\U00000600", {2325, 1536}, {2, 3}}, - {L"\U00000915\U00000a03", {2325}, {2}}, - {L"\U00000915\U00000308\U00000a03", {2325}, {3}}, - {L"\U00000915\U00001100", {2325, 4352}, {1, 2}}, - {L"\U00000915\U00000308\U00001100", {2325, 4352}, {2, 3}}, - {L"\U00000915\U00001160", {2325, 4448}, {1, 2}}, - {L"\U00000915\U00000308\U00001160", {2325, 4448}, {2, 3}}, - {L"\U00000915\U000011a8", {2325, 4520}, {1, 2}}, - {L"\U00000915\U00000308\U000011a8", {2325, 4520}, {2, 3}}, - {L"\U00000915\U0000ac00", {2325, 44032}, {1, 2}}, - {L"\U00000915\U00000308\U0000ac00", {2325, 44032}, {2, 3}}, - {L"\U00000915\U0000ac01", {2325, 44033}, {1, 2}}, - {L"\U00000915\U00000308\U0000ac01", {2325, 44033}, {2, 3}}, - {L"\U00000915\U00000903", {2325}, {2}}, - {L"\U00000915\U00000308\U00000903", {2325}, {3}}, - {L"\U00000915\U00000904", {2325, 2308}, {1, 2}}, - {L"\U00000915\U00000308\U00000904", {2325, 2308}, {2, 3}}, - {L"\U00000915\U00000d4e", {2325, 3406}, {1, 2}}, - {L"\U00000915\U00000308\U00000d4e", {2325, 3406}, {2, 3}}, - {L"\U00000915\U00000915", {2325, 2325}, {1, 2}}, - {L"\U00000915\U00000308\U00000915", {2325, 2325}, {2, 3}}, - {L"\U00000915\U0000231a", {2325, 8986}, {1, 2}}, - {L"\U00000915\U00000308\U0000231a", {2325, 8986}, {2, 3}}, - {L"\U00000915\U00000300", {2325}, {2}}, - {L"\U00000915\U00000308\U00000300", {2325}, {3}}, - {L"\U00000915\U00000900", {2325}, {2}}, - {L"\U00000915\U00000308\U00000900", {2325}, {3}}, - {L"\U00000915\U0000094d", {2325}, {2}}, - {L"\U00000915\U00000308\U0000094d", {2325}, {3}}, - {L"\U00000915\U0000200d", {2325}, {2}}, - {L"\U00000915\U00000308\U0000200d", {2325}, {3}}, - {L"\U00000915\U00000378", {2325, 888}, {1, 2}}, - {L"\U00000915\U00000308\U00000378", {2325, 888}, {2, 3}}, - {L"\U0000231a\U00000020", {8986, 32}, {1, 2}}, - {L"\U0000231a\U00000308\U00000020", {8986, 32}, {2, 3}}, - {L"\U0000231a\U0000000d", {8986, 13}, {1, 2}}, - {L"\U0000231a\U00000308\U0000000d", {8986, 13}, {2, 3}}, - {L"\U0000231a\U0000000a", {8986, 10}, {1, 2}}, - {L"\U0000231a\U00000308\U0000000a", {8986, 10}, {2, 3}}, - {L"\U0000231a\U00000001", {8986, 1}, {1, 2}}, - {L"\U0000231a\U00000308\U00000001", {8986, 1}, {2, 3}}, - {L"\U0000231a\U0000200c", {8986}, {2}}, - {L"\U0000231a\U00000308\U0000200c", {8986}, {3}}, - {L"\U0000231a\U0001f1e6", {8986, 127462}, {1, 3}}, - {L"\U0000231a\U00000308\U0001f1e6", {8986, 127462}, {2, 4}}, - {L"\U0000231a\U00000600", {8986, 1536}, {1, 2}}, - {L"\U0000231a\U00000308\U00000600", {8986, 1536}, {2, 3}}, - {L"\U0000231a\U00000a03", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000a03", {8986}, {3}}, - {L"\U0000231a\U00001100", {8986, 4352}, {1, 2}}, - {L"\U0000231a\U00000308\U00001100", {8986, 4352}, {2, 3}}, - {L"\U0000231a\U00001160", {8986, 4448}, {1, 2}}, - {L"\U0000231a\U00000308\U00001160", {8986, 4448}, {2, 3}}, - {L"\U0000231a\U000011a8", {8986, 4520}, {1, 2}}, - {L"\U0000231a\U00000308\U000011a8", {8986, 4520}, {2, 3}}, - {L"\U0000231a\U0000ac00", {8986, 44032}, {1, 2}}, - {L"\U0000231a\U00000308\U0000ac00", {8986, 44032}, {2, 3}}, - {L"\U0000231a\U0000ac01", {8986, 44033}, {1, 2}}, - {L"\U0000231a\U00000308\U0000ac01", {8986, 44033}, {2, 3}}, - {L"\U0000231a\U00000903", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000903", {8986}, {3}}, - {L"\U0000231a\U00000904", {8986, 2308}, {1, 2}}, - {L"\U0000231a\U00000308\U00000904", {8986, 2308}, {2, 3}}, - {L"\U0000231a\U00000d4e", {8986, 3406}, {1, 2}}, - {L"\U0000231a\U00000308\U00000d4e", {8986, 3406}, {2, 3}}, - {L"\U0000231a\U00000915", {8986, 2325}, {1, 2}}, - {L"\U0000231a\U00000308\U00000915", {8986, 2325}, {2, 3}}, - {L"\U0000231a\U0000231a", {8986, 8986}, {1, 2}}, - {L"\U0000231a\U00000308\U0000231a", {8986, 8986}, {2, 3}}, - {L"\U0000231a\U00000300", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000300", {8986}, {3}}, - {L"\U0000231a\U00000900", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000900", {8986}, {3}}, - {L"\U0000231a\U0000094d", {8986}, {2}}, - {L"\U0000231a\U00000308\U0000094d", {8986}, {3}}, - {L"\U0000231a\U0000200d", {8986}, {2}}, - {L"\U0000231a\U00000308\U0000200d", {8986}, {3}}, - {L"\U0000231a\U00000378", {8986, 888}, {1, 2}}, - {L"\U0000231a\U00000308\U00000378", {8986, 888}, {2, 3}}, - {L"\U00000300\U00000020", {768, 32}, {1, 2}}, - {L"\U00000300\U00000308\U00000020", {768, 32}, {2, 3}}, - {L"\U00000300\U0000000d", {768, 13}, {1, 2}}, - {L"\U00000300\U00000308\U0000000d", {768, 13}, {2, 3}}, - {L"\U00000300\U0000000a", {768, 10}, {1, 2}}, - {L"\U00000300\U00000308\U0000000a", {768, 10}, {2, 3}}, - {L"\U00000300\U00000001", {768, 1}, {1, 2}}, - {L"\U00000300\U00000308\U00000001", {768, 1}, {2, 3}}, - {L"\U00000300\U0000200c", {768}, {2}}, - {L"\U00000300\U00000308\U0000200c", {768}, {3}}, - {L"\U00000300\U0001f1e6", {768, 127462}, {1, 3}}, - {L"\U00000300\U00000308\U0001f1e6", {768, 127462}, {2, 4}}, - {L"\U00000300\U00000600", {768, 1536}, {1, 2}}, - {L"\U00000300\U00000308\U00000600", {768, 1536}, {2, 3}}, - {L"\U00000300\U00000a03", {768}, {2}}, - {L"\U00000300\U00000308\U00000a03", {768}, {3}}, - {L"\U00000300\U00001100", {768, 4352}, {1, 2}}, - {L"\U00000300\U00000308\U00001100", {768, 4352}, {2, 3}}, - {L"\U00000300\U00001160", {768, 4448}, {1, 2}}, - {L"\U00000300\U00000308\U00001160", {768, 4448}, {2, 3}}, - {L"\U00000300\U000011a8", {768, 4520}, {1, 2}}, - {L"\U00000300\U00000308\U000011a8", {768, 4520}, {2, 3}}, - {L"\U00000300\U0000ac00", {768, 44032}, {1, 2}}, - {L"\U00000300\U00000308\U0000ac00", {768, 44032}, {2, 3}}, - {L"\U00000300\U0000ac01", {768, 44033}, {1, 2}}, - {L"\U00000300\U00000308\U0000ac01", {768, 44033}, {2, 3}}, - {L"\U00000300\U00000903", {768}, {2}}, - {L"\U00000300\U00000308\U00000903", {768}, {3}}, - {L"\U00000300\U00000904", {768, 2308}, {1, 2}}, - {L"\U00000300\U00000308\U00000904", {768, 2308}, {2, 3}}, - {L"\U00000300\U00000d4e", {768, 3406}, {1, 2}}, - {L"\U00000300\U00000308\U00000d4e", {768, 3406}, {2, 3}}, - {L"\U00000300\U00000915", {768, 2325}, {1, 2}}, - {L"\U00000300\U00000308\U00000915", {768, 2325}, {2, 3}}, - {L"\U00000300\U0000231a", {768, 8986}, {1, 2}}, - {L"\U00000300\U00000308\U0000231a", {768, 8986}, {2, 3}}, - {L"\U00000300\U00000300", {768}, {2}}, - {L"\U00000300\U00000308\U00000300", {768}, {3}}, - {L"\U00000300\U00000900", {768}, {2}}, - {L"\U00000300\U00000308\U00000900", {768}, {3}}, - {L"\U00000300\U0000094d", {768}, {2}}, - {L"\U00000300\U00000308\U0000094d", {768}, {3}}, - {L"\U00000300\U0000200d", {768}, {2}}, - {L"\U00000300\U00000308\U0000200d", {768}, {3}}, - {L"\U00000300\U00000378", {768, 888}, {1, 2}}, - {L"\U00000300\U00000308\U00000378", {768, 888}, {2, 3}}, - {L"\U00000900\U00000020", {2304, 32}, {1, 2}}, - {L"\U00000900\U00000308\U00000020", {2304, 32}, {2, 3}}, - {L"\U00000900\U0000000d", {2304, 13}, {1, 2}}, - {L"\U00000900\U00000308\U0000000d", {2304, 13}, {2, 3}}, - {L"\U00000900\U0000000a", {2304, 10}, {1, 2}}, - {L"\U00000900\U00000308\U0000000a", {2304, 10}, {2, 3}}, - {L"\U00000900\U00000001", {2304, 1}, {1, 2}}, - {L"\U00000900\U00000308\U00000001", {2304, 1}, {2, 3}}, - {L"\U00000900\U0000200c", {2304}, {2}}, - {L"\U00000900\U00000308\U0000200c", {2304}, {3}}, - {L"\U00000900\U0001f1e6", {2304, 127462}, {1, 3}}, - {L"\U00000900\U00000308\U0001f1e6", {2304, 127462}, {2, 4}}, - {L"\U00000900\U00000600", {2304, 1536}, {1, 2}}, - {L"\U00000900\U00000308\U00000600", {2304, 1536}, {2, 3}}, - {L"\U00000900\U00000a03", {2304}, {2}}, - {L"\U00000900\U00000308\U00000a03", {2304}, {3}}, - {L"\U00000900\U00001100", {2304, 4352}, {1, 2}}, - {L"\U00000900\U00000308\U00001100", {2304, 4352}, {2, 3}}, - {L"\U00000900\U00001160", {2304, 4448}, {1, 2}}, - {L"\U00000900\U00000308\U00001160", {2304, 4448}, {2, 3}}, - {L"\U00000900\U000011a8", {2304, 4520}, {1, 2}}, - {L"\U00000900\U00000308\U000011a8", {2304, 4520}, {2, 3}}, - {L"\U00000900\U0000ac00", {2304, 44032}, {1, 2}}, - {L"\U00000900\U00000308\U0000ac00", {2304, 44032}, {2, 3}}, - {L"\U00000900\U0000ac01", {2304, 44033}, {1, 2}}, - {L"\U00000900\U00000308\U0000ac01", {2304, 44033}, {2, 3}}, - {L"\U00000900\U00000903", {2304}, {2}}, - {L"\U00000900\U00000308\U00000903", {2304}, {3}}, - {L"\U00000900\U00000904", {2304, 2308}, {1, 2}}, - {L"\U00000900\U00000308\U00000904", {2304, 2308}, {2, 3}}, - {L"\U00000900\U00000d4e", {2304, 3406}, {1, 2}}, - {L"\U00000900\U00000308\U00000d4e", {2304, 3406}, {2, 3}}, - {L"\U00000900\U00000915", {2304, 2325}, {1, 2}}, - {L"\U00000900\U00000308\U00000915", {2304, 2325}, {2, 3}}, - {L"\U00000900\U0000231a", {2304, 8986}, {1, 2}}, - {L"\U00000900\U00000308\U0000231a", {2304, 8986}, {2, 3}}, - {L"\U00000900\U00000300", {2304}, {2}}, - {L"\U00000900\U00000308\U00000300", {2304}, {3}}, - {L"\U00000900\U00000900", {2304}, {2}}, - {L"\U00000900\U00000308\U00000900", {2304}, {3}}, - {L"\U00000900\U0000094d", {2304}, {2}}, - {L"\U00000900\U00000308\U0000094d", {2304}, {3}}, - {L"\U00000900\U0000200d", {2304}, {2}}, - {L"\U00000900\U00000308\U0000200d", {2304}, {3}}, - {L"\U00000900\U00000378", {2304, 888}, {1, 2}}, - {L"\U00000900\U00000308\U00000378", {2304, 888}, {2, 3}}, - {L"\U0000094d\U00000020", {2381, 32}, {1, 2}}, - {L"\U0000094d\U00000308\U00000020", {2381, 32}, {2, 3}}, - {L"\U0000094d\U0000000d", {2381, 13}, {1, 2}}, - {L"\U0000094d\U00000308\U0000000d", {2381, 13}, {2, 3}}, - {L"\U0000094d\U0000000a", {2381, 10}, {1, 2}}, - {L"\U0000094d\U00000308\U0000000a", {2381, 10}, {2, 3}}, - {L"\U0000094d\U00000001", {2381, 1}, {1, 2}}, - {L"\U0000094d\U00000308\U00000001", {2381, 1}, {2, 3}}, - {L"\U0000094d\U0000200c", {2381}, {2}}, - {L"\U0000094d\U00000308\U0000200c", {2381}, {3}}, - {L"\U0000094d\U0001f1e6", {2381, 127462}, {1, 3}}, - {L"\U0000094d\U00000308\U0001f1e6", {2381, 127462}, {2, 4}}, - {L"\U0000094d\U00000600", {2381, 1536}, {1, 2}}, - {L"\U0000094d\U00000308\U00000600", {2381, 1536}, {2, 3}}, - {L"\U0000094d\U00000a03", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000a03", {2381}, {3}}, - {L"\U0000094d\U00001100", {2381, 4352}, {1, 2}}, - {L"\U0000094d\U00000308\U00001100", {2381, 4352}, {2, 3}}, - {L"\U0000094d\U00001160", {2381, 4448}, {1, 2}}, - {L"\U0000094d\U00000308\U00001160", {2381, 4448}, {2, 3}}, - {L"\U0000094d\U000011a8", {2381, 4520}, {1, 2}}, - {L"\U0000094d\U00000308\U000011a8", {2381, 4520}, {2, 3}}, - {L"\U0000094d\U0000ac00", {2381, 44032}, {1, 2}}, - {L"\U0000094d\U00000308\U0000ac00", {2381, 44032}, {2, 3}}, - {L"\U0000094d\U0000ac01", {2381, 44033}, {1, 2}}, - {L"\U0000094d\U00000308\U0000ac01", {2381, 44033}, {2, 3}}, - {L"\U0000094d\U00000903", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000903", {2381}, {3}}, - {L"\U0000094d\U00000904", {2381, 2308}, {1, 2}}, - {L"\U0000094d\U00000308\U00000904", {2381, 2308}, {2, 3}}, - {L"\U0000094d\U00000d4e", {2381, 3406}, {1, 2}}, - {L"\U0000094d\U00000308\U00000d4e", {2381, 3406}, {2, 3}}, - {L"\U0000094d\U00000915", {2381, 2325}, {1, 2}}, - {L"\U0000094d\U00000308\U00000915", {2381, 2325}, {2, 3}}, - {L"\U0000094d\U0000231a", {2381, 8986}, {1, 2}}, - {L"\U0000094d\U00000308\U0000231a", {2381, 8986}, {2, 3}}, - {L"\U0000094d\U00000300", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000300", {2381}, {3}}, - {L"\U0000094d\U00000900", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000900", {2381}, {3}}, - {L"\U0000094d\U0000094d", {2381}, {2}}, - {L"\U0000094d\U00000308\U0000094d", {2381}, {3}}, - {L"\U0000094d\U0000200d", {2381}, {2}}, - {L"\U0000094d\U00000308\U0000200d", {2381}, {3}}, - {L"\U0000094d\U00000378", {2381, 888}, {1, 2}}, - {L"\U0000094d\U00000308\U00000378", {2381, 888}, {2, 3}}, - {L"\U0000200d\U00000020", {8205, 32}, {1, 2}}, - {L"\U0000200d\U00000308\U00000020", {8205, 32}, {2, 3}}, - {L"\U0000200d\U0000000d", {8205, 13}, {1, 2}}, - {L"\U0000200d\U00000308\U0000000d", {8205, 13}, {2, 3}}, - {L"\U0000200d\U0000000a", {8205, 10}, {1, 2}}, - {L"\U0000200d\U00000308\U0000000a", {8205, 10}, {2, 3}}, - {L"\U0000200d\U00000001", {8205, 1}, {1, 2}}, - {L"\U0000200d\U00000308\U00000001", {8205, 1}, {2, 3}}, - {L"\U0000200d\U0000200c", {8205}, {2}}, - {L"\U0000200d\U00000308\U0000200c", {8205}, {3}}, - {L"\U0000200d\U0001f1e6", {8205, 127462}, {1, 3}}, - {L"\U0000200d\U00000308\U0001f1e6", {8205, 127462}, {2, 4}}, - {L"\U0000200d\U00000600", {8205, 1536}, {1, 2}}, - {L"\U0000200d\U00000308\U00000600", {8205, 1536}, {2, 3}}, - {L"\U0000200d\U00000a03", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000a03", {8205}, {3}}, - {L"\U0000200d\U00001100", {8205, 4352}, {1, 2}}, - {L"\U0000200d\U00000308\U00001100", {8205, 4352}, {2, 3}}, - {L"\U0000200d\U00001160", {8205, 4448}, {1, 2}}, - {L"\U0000200d\U00000308\U00001160", {8205, 4448}, {2, 3}}, - {L"\U0000200d\U000011a8", {8205, 4520}, {1, 2}}, - {L"\U0000200d\U00000308\U000011a8", {8205, 4520}, {2, 3}}, - {L"\U0000200d\U0000ac00", {8205, 44032}, {1, 2}}, - {L"\U0000200d\U00000308\U0000ac00", {8205, 44032}, {2, 3}}, - {L"\U0000200d\U0000ac01", {8205, 44033}, {1, 2}}, - {L"\U0000200d\U00000308\U0000ac01", {8205, 44033}, {2, 3}}, - {L"\U0000200d\U00000903", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000903", {8205}, {3}}, - {L"\U0000200d\U00000904", {8205, 2308}, {1, 2}}, - {L"\U0000200d\U00000308\U00000904", {8205, 2308}, {2, 3}}, - {L"\U0000200d\U00000d4e", {8205, 3406}, {1, 2}}, - {L"\U0000200d\U00000308\U00000d4e", {8205, 3406}, {2, 3}}, - {L"\U0000200d\U00000915", {8205, 2325}, {1, 2}}, - {L"\U0000200d\U00000308\U00000915", {8205, 2325}, {2, 3}}, - {L"\U0000200d\U0000231a", {8205, 8986}, {1, 2}}, - {L"\U0000200d\U00000308\U0000231a", {8205, 8986}, {2, 3}}, - {L"\U0000200d\U00000300", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000300", {8205}, {3}}, - {L"\U0000200d\U00000900", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000900", {8205}, {3}}, - {L"\U0000200d\U0000094d", {8205}, {2}}, - {L"\U0000200d\U00000308\U0000094d", {8205}, {3}}, - {L"\U0000200d\U0000200d", {8205}, {2}}, - {L"\U0000200d\U00000308\U0000200d", {8205}, {3}}, - {L"\U0000200d\U00000378", {8205, 888}, {1, 2}}, - {L"\U0000200d\U00000308\U00000378", {8205, 888}, {2, 3}}, - {L"\U00000378\U00000020", {888, 32}, {1, 2}}, - {L"\U00000378\U00000308\U00000020", {888, 32}, {2, 3}}, - {L"\U00000378\U0000000d", {888, 13}, {1, 2}}, - {L"\U00000378\U00000308\U0000000d", {888, 13}, {2, 3}}, - {L"\U00000378\U0000000a", {888, 10}, {1, 2}}, - {L"\U00000378\U00000308\U0000000a", {888, 10}, {2, 3}}, - {L"\U00000378\U00000001", {888, 1}, {1, 2}}, - {L"\U00000378\U00000308\U00000001", {888, 1}, {2, 3}}, - {L"\U00000378\U0000200c", {888}, {2}}, - {L"\U00000378\U00000308\U0000200c", {888}, {3}}, - {L"\U00000378\U0001f1e6", {888, 127462}, {1, 3}}, - {L"\U00000378\U00000308\U0001f1e6", {888, 127462}, {2, 4}}, - {L"\U00000378\U00000600", {888, 1536}, {1, 2}}, - {L"\U00000378\U00000308\U00000600", {888, 1536}, {2, 3}}, - {L"\U00000378\U00000a03", {888}, {2}}, - {L"\U00000378\U00000308\U00000a03", {888}, {3}}, - {L"\U00000378\U00001100", {888, 4352}, {1, 2}}, - {L"\U00000378\U00000308\U00001100", {888, 4352}, {2, 3}}, - {L"\U00000378\U00001160", {888, 4448}, {1, 2}}, - {L"\U00000378\U00000308\U00001160", {888, 4448}, {2, 3}}, - {L"\U00000378\U000011a8", {888, 4520}, {1, 2}}, - {L"\U00000378\U00000308\U000011a8", {888, 4520}, {2, 3}}, - {L"\U00000378\U0000ac00", {888, 44032}, {1, 2}}, - {L"\U00000378\U00000308\U0000ac00", {888, 44032}, {2, 3}}, - {L"\U00000378\U0000ac01", {888, 44033}, {1, 2}}, - {L"\U00000378\U00000308\U0000ac01", {888, 44033}, {2, 3}}, - {L"\U00000378\U00000903", {888}, {2}}, - {L"\U00000378\U00000308\U00000903", {888}, {3}}, - {L"\U00000378\U00000904", {888, 2308}, {1, 2}}, - {L"\U00000378\U00000308\U00000904", {888, 2308}, {2, 3}}, - {L"\U00000378\U00000d4e", {888, 3406}, {1, 2}}, - {L"\U00000378\U00000308\U00000d4e", {888, 3406}, {2, 3}}, - {L"\U00000378\U00000915", {888, 2325}, {1, 2}}, - {L"\U00000378\U00000308\U00000915", {888, 2325}, {2, 3}}, - {L"\U00000378\U0000231a", {888, 8986}, {1, 2}}, - {L"\U00000378\U00000308\U0000231a", {888, 8986}, {2, 3}}, - {L"\U00000378\U00000300", {888}, {2}}, - {L"\U00000378\U00000308\U00000300", {888}, {3}}, - {L"\U00000378\U00000900", {888}, {2}}, - {L"\U00000378\U00000308\U00000900", {888}, {3}}, - {L"\U00000378\U0000094d", {888}, {2}}, - {L"\U00000378\U00000308\U0000094d", {888}, {3}}, - {L"\U00000378\U0000200d", {888}, {2}}, - {L"\U00000378\U00000308\U0000200d", {888}, {3}}, - {L"\U00000378\U00000378", {888, 888}, {1, 2}}, - {L"\U00000378\U00000308\U00000378", {888, 888}, {2, 3}}, - {L"\U0000000d\U0000000a\U00000061\U0000000a\U00000308", {13, 97, 10, 776}, {2, 3, 4, 5}}, - {L"\U00000061\U00000308", {97}, {2}}, - {L"\U00000020\U0000200d\U00000646", {32, 1606}, {2, 3}}, - {L"\U00000646\U0000200d\U00000020", {1606, 32}, {2, 3}}, - {L"\U00001100\U00001100", {4352}, {2}}, - {L"\U0000ac00\U000011a8\U00001100", {44032, 4352}, {2, 3}}, - {L"\U0000ac01\U000011a8\U00001100", {44033, 4352}, {2, 3}}, - {L"\U0001f1e6\U0001f1e7\U0001f1e8\U00000062", {127462, 127464, 98}, {4, 6, 7}}, - {L"\U00000061\U0001f1e6\U0001f1e7\U0001f1e8\U00000062", {97, 127462, 127464, 98}, {1, 5, 7, 8}}, - {L"\U00000061\U0001f1e6\U0001f1e7\U0000200d\U0001f1e8\U00000062", {97, 127462, 127464, 98}, {1, 6, 8, 9}}, - {L"\U00000061\U0001f1e6\U0000200d\U0001f1e7\U0001f1e8\U00000062", {97, 127462, 127463, 98}, {1, 4, 8, 9}}, - {L"\U00000061\U0001f1e6\U0001f1e7\U0001f1e8\U0001f1e9\U00000062", {97, 127462, 127464, 98}, {1, 5, 9, 10}}, - {L"\U00000061\U0000200d", {97}, {2}}, - {L"\U00000061\U00000308\U00000062", {97, 98}, {2, 3}}, - {L"\U00000061\U00000903\U00000062", {97, 98}, {2, 3}}, - {L"\U00000061\U00000600\U00000062", {97, 1536}, {1, 3}}, - {L"\U0001f476\U0001f3ff\U0001f476", {128118, 128118}, {4, 6}}, - {L"\U00000061\U0001f3ff\U0001f476", {97, 128118}, {3, 5}}, - {L"\U00000061\U0001f3ff\U0001f476\U0000200d\U0001f6d1", {97, 128118}, {3, 8}}, - {L"\U0001f476\U0001f3ff\U00000308\U0000200d\U0001f476\U0001f3ff", {128118}, {10}}, - {L"\U0001f6d1\U0000200d\U0001f6d1", {128721}, {5}}, - {L"\U00000061\U0000200d\U0001f6d1", {97, 128721}, {2, 4}}, - {L"\U00002701\U0000200d\U00002701", {9985}, {3}}, - {L"\U00000061\U0000200d\U00002701", {97, 9985}, {2, 3}}, - {L"\U00000915\U00000924", {2325, 2340}, {1, 2}}, - {L"\U00000915\U0000094d\U00000924", {2325}, {3}}, - {L"\U00000915\U0000094d\U0000094d\U00000924", {2325}, {4}}, - {L"\U00000915\U0000094d\U0000200d\U00000924", {2325}, {4}}, - {L"\U00000915\U0000093c\U0000200d\U0000094d\U00000924", {2325}, {5}}, - {L"\U00000915\U0000093c\U0000094d\U0000200d\U00000924", {2325}, {5}}, - {L"\U00000915\U0000094d\U00000924\U0000094d\U0000092f", {2325}, {5}}, - {L"\U00000915\U0000094d\U00000061", {2325, 97}, {2, 3}}, - {L"\U00000061\U0000094d\U00000924", {97, 2340}, {2, 3}}, - {L"\U0000003f\U0000094d\U00000924", {63, 2340}, {2, 3}}, - {L"\U00000915\U0000094d\U0000094d\U00000924", {2325}, {4}}}}; - -/// The data for UTF-8. -/// -/// Note that most of the data for the UTF-16 and UTF-32 are identical. However -/// since the size of the code units differ the breaks can contain different -/// values. -std::array<data<wchar_t>, 1093> data_utf32 = {{ - {L"\U00000020\U00000020", {32, 32}, {1, 2}}, - {L"\U00000020\U00000308\U00000020", {32, 32}, {2, 3}}, - {L"\U00000020\U0000000d", {32, 13}, {1, 2}}, - {L"\U00000020\U00000308\U0000000d", {32, 13}, {2, 3}}, - {L"\U00000020\U0000000a", {32, 10}, {1, 2}}, - {L"\U00000020\U00000308\U0000000a", {32, 10}, {2, 3}}, - {L"\U00000020\U00000001", {32, 1}, {1, 2}}, - {L"\U00000020\U00000308\U00000001", {32, 1}, {2, 3}}, - {L"\U00000020\U0000200c", {32}, {2}}, - {L"\U00000020\U00000308\U0000200c", {32}, {3}}, - {L"\U00000020\U0001f1e6", {32, 127462}, {1, 2}}, - {L"\U00000020\U00000308\U0001f1e6", {32, 127462}, {2, 3}}, - {L"\U00000020\U00000600", {32, 1536}, {1, 2}}, - {L"\U00000020\U00000308\U00000600", {32, 1536}, {2, 3}}, - {L"\U00000020\U00000a03", {32}, {2}}, - {L"\U00000020\U00000308\U00000a03", {32}, {3}}, - {L"\U00000020\U00001100", {32, 4352}, {1, 2}}, - {L"\U00000020\U00000308\U00001100", {32, 4352}, {2, 3}}, - {L"\U00000020\U00001160", {32, 4448}, {1, 2}}, - {L"\U00000020\U00000308\U00001160", {32, 4448}, {2, 3}}, - {L"\U00000020\U000011a8", {32, 4520}, {1, 2}}, - {L"\U00000020\U00000308\U000011a8", {32, 4520}, {2, 3}}, - {L"\U00000020\U0000ac00", {32, 44032}, {1, 2}}, - {L"\U00000020\U00000308\U0000ac00", {32, 44032}, {2, 3}}, - {L"\U00000020\U0000ac01", {32, 44033}, {1, 2}}, - {L"\U00000020\U00000308\U0000ac01", {32, 44033}, {2, 3}}, - {L"\U00000020\U00000903", {32}, {2}}, - {L"\U00000020\U00000308\U00000903", {32}, {3}}, - {L"\U00000020\U00000904", {32, 2308}, {1, 2}}, - {L"\U00000020\U00000308\U00000904", {32, 2308}, {2, 3}}, - {L"\U00000020\U00000d4e", {32, 3406}, {1, 2}}, - {L"\U00000020\U00000308\U00000d4e", {32, 3406}, {2, 3}}, - {L"\U00000020\U00000915", {32, 2325}, {1, 2}}, - {L"\U00000020\U00000308\U00000915", {32, 2325}, {2, 3}}, - {L"\U00000020\U0000231a", {32, 8986}, {1, 2}}, - {L"\U00000020\U00000308\U0000231a", {32, 8986}, {2, 3}}, - {L"\U00000020\U00000300", {32}, {2}}, - {L"\U00000020\U00000308\U00000300", {32}, {3}}, - {L"\U00000020\U00000900", {32}, {2}}, - {L"\U00000020\U00000308\U00000900", {32}, {3}}, - {L"\U00000020\U0000094d", {32}, {2}}, - {L"\U00000020\U00000308\U0000094d", {32}, {3}}, - {L"\U00000020\U0000200d", {32}, {2}}, - {L"\U00000020\U00000308\U0000200d", {32}, {3}}, - {L"\U00000020\U00000378", {32, 888}, {1, 2}}, - {L"\U00000020\U00000308\U00000378", {32, 888}, {2, 3}}, - {L"\U0000000d\U00000020", {13, 32}, {1, 2}}, - {L"\U0000000d\U00000308\U00000020", {13, 776, 32}, {1, 2, 3}}, - {L"\U0000000d\U0000000d", {13, 13}, {1, 2}}, - {L"\U0000000d\U00000308\U0000000d", {13, 776, 13}, {1, 2, 3}}, - {L"\U0000000d\U0000000a", {13}, {2}}, - {L"\U0000000d\U00000308\U0000000a", {13, 776, 10}, {1, 2, 3}}, - {L"\U0000000d\U00000001", {13, 1}, {1, 2}}, - {L"\U0000000d\U00000308\U00000001", {13, 776, 1}, {1, 2, 3}}, - {L"\U0000000d\U0000200c", {13, 8204}, {1, 2}}, - {L"\U0000000d\U00000308\U0000200c", {13, 776}, {1, 3}}, - {L"\U0000000d\U0001f1e6", {13, 127462}, {1, 2}}, - {L"\U0000000d\U00000308\U0001f1e6", {13, 776, 127462}, {1, 2, 3}}, - {L"\U0000000d\U00000600", {13, 1536}, {1, 2}}, - {L"\U0000000d\U00000308\U00000600", {13, 776, 1536}, {1, 2, 3}}, - {L"\U0000000d\U00000a03", {13, 2563}, {1, 2}}, - {L"\U0000000d\U00000308\U00000a03", {13, 776}, {1, 3}}, - {L"\U0000000d\U00001100", {13, 4352}, {1, 2}}, - {L"\U0000000d\U00000308\U00001100", {13, 776, 4352}, {1, 2, 3}}, - {L"\U0000000d\U00001160", {13, 4448}, {1, 2}}, - {L"\U0000000d\U00000308\U00001160", {13, 776, 4448}, {1, 2, 3}}, - {L"\U0000000d\U000011a8", {13, 4520}, {1, 2}}, - {L"\U0000000d\U00000308\U000011a8", {13, 776, 4520}, {1, 2, 3}}, - {L"\U0000000d\U0000ac00", {13, 44032}, {1, 2}}, - {L"\U0000000d\U00000308\U0000ac00", {13, 776, 44032}, {1, 2, 3}}, - {L"\U0000000d\U0000ac01", {13, 44033}, {1, 2}}, - {L"\U0000000d\U00000308\U0000ac01", {13, 776, 44033}, {1, 2, 3}}, - {L"\U0000000d\U00000903", {13, 2307}, {1, 2}}, - {L"\U0000000d\U00000308\U00000903", {13, 776}, {1, 3}}, - {L"\U0000000d\U00000904", {13, 2308}, {1, 2}}, - {L"\U0000000d\U00000308\U00000904", {13, 776, 2308}, {1, 2, 3}}, - {L"\U0000000d\U00000d4e", {13, 3406}, {1, 2}}, - {L"\U0000000d\U00000308\U00000d4e", {13, 776, 3406}, {1, 2, 3}}, - {L"\U0000000d\U00000915", {13, 2325}, {1, 2}}, - {L"\U0000000d\U00000308\U00000915", {13, 776, 2325}, {1, 2, 3}}, - {L"\U0000000d\U0000231a", {13, 8986}, {1, 2}}, - {L"\U0000000d\U00000308\U0000231a", {13, 776, 8986}, {1, 2, 3}}, - {L"\U0000000d\U00000300", {13, 768}, {1, 2}}, - {L"\U0000000d\U00000308\U00000300", {13, 776}, {1, 3}}, - {L"\U0000000d\U00000900", {13, 2304}, {1, 2}}, - {L"\U0000000d\U00000308\U00000900", {13, 776}, {1, 3}}, - {L"\U0000000d\U0000094d", {13, 2381}, {1, 2}}, - {L"\U0000000d\U00000308\U0000094d", {13, 776}, {1, 3}}, - {L"\U0000000d\U0000200d", {13, 8205}, {1, 2}}, - {L"\U0000000d\U00000308\U0000200d", {13, 776}, {1, 3}}, - {L"\U0000000d\U00000378", {13, 888}, {1, 2}}, - {L"\U0000000d\U00000308\U00000378", {13, 776, 888}, {1, 2, 3}}, - {L"\U0000000a\U00000020", {10, 32}, {1, 2}}, - {L"\U0000000a\U00000308\U00000020", {10, 776, 32}, {1, 2, 3}}, - {L"\U0000000a\U0000000d", {10, 13}, {1, 2}}, - {L"\U0000000a\U00000308\U0000000d", {10, 776, 13}, {1, 2, 3}}, - {L"\U0000000a\U0000000a", {10, 10}, {1, 2}}, - {L"\U0000000a\U00000308\U0000000a", {10, 776, 10}, {1, 2, 3}}, - {L"\U0000000a\U00000001", {10, 1}, {1, 2}}, - {L"\U0000000a\U00000308\U00000001", {10, 776, 1}, {1, 2, 3}}, - {L"\U0000000a\U0000200c", {10, 8204}, {1, 2}}, - {L"\U0000000a\U00000308\U0000200c", {10, 776}, {1, 3}}, - {L"\U0000000a\U0001f1e6", {10, 127462}, {1, 2}}, - {L"\U0000000a\U00000308\U0001f1e6", {10, 776, 127462}, {1, 2, 3}}, - {L"\U0000000a\U00000600", {10, 1536}, {1, 2}}, - {L"\U0000000a\U00000308\U00000600", {10, 776, 1536}, {1, 2, 3}}, - {L"\U0000000a\U00000a03", {10, 2563}, {1, 2}}, - {L"\U0000000a\U00000308\U00000a03", {10, 776}, {1, 3}}, - {L"\U0000000a\U00001100", {10, 4352}, {1, 2}}, - {L"\U0000000a\U00000308\U00001100", {10, 776, 4352}, {1, 2, 3}}, - {L"\U0000000a\U00001160", {10, 4448}, {1, 2}}, - {L"\U0000000a\U00000308\U00001160", {10, 776, 4448}, {1, 2, 3}}, - {L"\U0000000a\U000011a8", {10, 4520}, {1, 2}}, - {L"\U0000000a\U00000308\U000011a8", {10, 776, 4520}, {1, 2, 3}}, - {L"\U0000000a\U0000ac00", {10, 44032}, {1, 2}}, - {L"\U0000000a\U00000308\U0000ac00", {10, 776, 44032}, {1, 2, 3}}, - {L"\U0000000a\U0000ac01", {10, 44033}, {1, 2}}, - {L"\U0000000a\U00000308\U0000ac01", {10, 776, 44033}, {1, 2, 3}}, - {L"\U0000000a\U00000903", {10, 2307}, {1, 2}}, - {L"\U0000000a\U00000308\U00000903", {10, 776}, {1, 3}}, - {L"\U0000000a\U00000904", {10, 2308}, {1, 2}}, - {L"\U0000000a\U00000308\U00000904", {10, 776, 2308}, {1, 2, 3}}, - {L"\U0000000a\U00000d4e", {10, 3406}, {1, 2}}, - {L"\U0000000a\U00000308\U00000d4e", {10, 776, 3406}, {1, 2, 3}}, - {L"\U0000000a\U00000915", {10, 2325}, {1, 2}}, - {L"\U0000000a\U00000308\U00000915", {10, 776, 2325}, {1, 2, 3}}, - {L"\U0000000a\U0000231a", {10, 8986}, {1, 2}}, - {L"\U0000000a\U00000308\U0000231a", {10, 776, 8986}, {1, 2, 3}}, - {L"\U0000000a\U00000300", {10, 768}, {1, 2}}, - {L"\U0000000a\U00000308\U00000300", {10, 776}, {1, 3}}, - {L"\U0000000a\U00000900", {10, 2304}, {1, 2}}, - {L"\U0000000a\U00000308\U00000900", {10, 776}, {1, 3}}, - {L"\U0000000a\U0000094d", {10, 2381}, {1, 2}}, - {L"\U0000000a\U00000308\U0000094d", {10, 776}, {1, 3}}, - {L"\U0000000a\U0000200d", {10, 8205}, {1, 2}}, - {L"\U0000000a\U00000308\U0000200d", {10, 776}, {1, 3}}, - {L"\U0000000a\U00000378", {10, 888}, {1, 2}}, - {L"\U0000000a\U00000308\U00000378", {10, 776, 888}, {1, 2, 3}}, - {L"\U00000001\U00000020", {1, 32}, {1, 2}}, - {L"\U00000001\U00000308\U00000020", {1, 776, 32}, {1, 2, 3}}, - {L"\U00000001\U0000000d", {1, 13}, {1, 2}}, - {L"\U00000001\U00000308\U0000000d", {1, 776, 13}, {1, 2, 3}}, - {L"\U00000001\U0000000a", {1, 10}, {1, 2}}, - {L"\U00000001\U00000308\U0000000a", {1, 776, 10}, {1, 2, 3}}, - {L"\U00000001\U00000001", {1, 1}, {1, 2}}, - {L"\U00000001\U00000308\U00000001", {1, 776, 1}, {1, 2, 3}}, - {L"\U00000001\U0000200c", {1, 8204}, {1, 2}}, - {L"\U00000001\U00000308\U0000200c", {1, 776}, {1, 3}}, - {L"\U00000001\U0001f1e6", {1, 127462}, {1, 2}}, - {L"\U00000001\U00000308\U0001f1e6", {1, 776, 127462}, {1, 2, 3}}, - {L"\U00000001\U00000600", {1, 1536}, {1, 2}}, - {L"\U00000001\U00000308\U00000600", {1, 776, 1536}, {1, 2, 3}}, - {L"\U00000001\U00000a03", {1, 2563}, {1, 2}}, - {L"\U00000001\U00000308\U00000a03", {1, 776}, {1, 3}}, - {L"\U00000001\U00001100", {1, 4352}, {1, 2}}, - {L"\U00000001\U00000308\U00001100", {1, 776, 4352}, {1, 2, 3}}, - {L"\U00000001\U00001160", {1, 4448}, {1, 2}}, - {L"\U00000001\U00000308\U00001160", {1, 776, 4448}, {1, 2, 3}}, - {L"\U00000001\U000011a8", {1, 4520}, {1, 2}}, - {L"\U00000001\U00000308\U000011a8", {1, 776, 4520}, {1, 2, 3}}, - {L"\U00000001\U0000ac00", {1, 44032}, {1, 2}}, - {L"\U00000001\U00000308\U0000ac00", {1, 776, 44032}, {1, 2, 3}}, - {L"\U00000001\U0000ac01", {1, 44033}, {1, 2}}, - {L"\U00000001\U00000308\U0000ac01", {1, 776, 44033}, {1, 2, 3}}, - {L"\U00000001\U00000903", {1, 2307}, {1, 2}}, - {L"\U00000001\U00000308\U00000903", {1, 776}, {1, 3}}, - {L"\U00000001\U00000904", {1, 2308}, {1, 2}}, - {L"\U00000001\U00000308\U00000904", {1, 776, 2308}, {1, 2, 3}}, - {L"\U00000001\U00000d4e", {1, 3406}, {1, 2}}, - {L"\U00000001\U00000308\U00000d4e", {1, 776, 3406}, {1, 2, 3}}, - {L"\U00000001\U00000915", {1, 2325}, {1, 2}}, - {L"\U00000001\U00000308\U00000915", {1, 776, 2325}, {1, 2, 3}}, - {L"\U00000001\U0000231a", {1, 8986}, {1, 2}}, - {L"\U00000001\U00000308\U0000231a", {1, 776, 8986}, {1, 2, 3}}, - {L"\U00000001\U00000300", {1, 768}, {1, 2}}, - {L"\U00000001\U00000308\U00000300", {1, 776}, {1, 3}}, - {L"\U00000001\U00000900", {1, 2304}, {1, 2}}, - {L"\U00000001\U00000308\U00000900", {1, 776}, {1, 3}}, - {L"\U00000001\U0000094d", {1, 2381}, {1, 2}}, - {L"\U00000001\U00000308\U0000094d", {1, 776}, {1, 3}}, - {L"\U00000001\U0000200d", {1, 8205}, {1, 2}}, - {L"\U00000001\U00000308\U0000200d", {1, 776}, {1, 3}}, - {L"\U00000001\U00000378", {1, 888}, {1, 2}}, - {L"\U00000001\U00000308\U00000378", {1, 776, 888}, {1, 2, 3}}, - {L"\U0000200c\U00000020", {8204, 32}, {1, 2}}, - {L"\U0000200c\U00000308\U00000020", {8204, 32}, {2, 3}}, - {L"\U0000200c\U0000000d", {8204, 13}, {1, 2}}, - {L"\U0000200c\U00000308\U0000000d", {8204, 13}, {2, 3}}, - {L"\U0000200c\U0000000a", {8204, 10}, {1, 2}}, - {L"\U0000200c\U00000308\U0000000a", {8204, 10}, {2, 3}}, - {L"\U0000200c\U00000001", {8204, 1}, {1, 2}}, - {L"\U0000200c\U00000308\U00000001", {8204, 1}, {2, 3}}, - {L"\U0000200c\U0000200c", {8204}, {2}}, - {L"\U0000200c\U00000308\U0000200c", {8204}, {3}}, - {L"\U0000200c\U0001f1e6", {8204, 127462}, {1, 2}}, - {L"\U0000200c\U00000308\U0001f1e6", {8204, 127462}, {2, 3}}, - {L"\U0000200c\U00000600", {8204, 1536}, {1, 2}}, - {L"\U0000200c\U00000308\U00000600", {8204, 1536}, {2, 3}}, - {L"\U0000200c\U00000a03", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000a03", {8204}, {3}}, - {L"\U0000200c\U00001100", {8204, 4352}, {1, 2}}, - {L"\U0000200c\U00000308\U00001100", {8204, 4352}, {2, 3}}, - {L"\U0000200c\U00001160", {8204, 4448}, {1, 2}}, - {L"\U0000200c\U00000308\U00001160", {8204, 4448}, {2, 3}}, - {L"\U0000200c\U000011a8", {8204, 4520}, {1, 2}}, - {L"\U0000200c\U00000308\U000011a8", {8204, 4520}, {2, 3}}, - {L"\U0000200c\U0000ac00", {8204, 44032}, {1, 2}}, - {L"\U0000200c\U00000308\U0000ac00", {8204, 44032}, {2, 3}}, - {L"\U0000200c\U0000ac01", {8204, 44033}, {1, 2}}, - {L"\U0000200c\U00000308\U0000ac01", {8204, 44033}, {2, 3}}, - {L"\U0000200c\U00000903", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000903", {8204}, {3}}, - {L"\U0000200c\U00000904", {8204, 2308}, {1, 2}}, - {L"\U0000200c\U00000308\U00000904", {8204, 2308}, {2, 3}}, - {L"\U0000200c\U00000d4e", {8204, 3406}, {1, 2}}, - {L"\U0000200c\U00000308\U00000d4e", {8204, 3406}, {2, 3}}, - {L"\U0000200c\U00000915", {8204, 2325}, {1, 2}}, - {L"\U0000200c\U00000308\U00000915", {8204, 2325}, {2, 3}}, - {L"\U0000200c\U0000231a", {8204, 8986}, {1, 2}}, - {L"\U0000200c\U00000308\U0000231a", {8204, 8986}, {2, 3}}, - {L"\U0000200c\U00000300", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000300", {8204}, {3}}, - {L"\U0000200c\U00000900", {8204}, {2}}, - {L"\U0000200c\U00000308\U00000900", {8204}, {3}}, - {L"\U0000200c\U0000094d", {8204}, {2}}, - {L"\U0000200c\U00000308\U0000094d", {8204}, {3}}, - {L"\U0000200c\U0000200d", {8204}, {2}}, - {L"\U0000200c\U00000308\U0000200d", {8204}, {3}}, - {L"\U0000200c\U00000378", {8204, 888}, {1, 2}}, - {L"\U0000200c\U00000308\U00000378", {8204, 888}, {2, 3}}, - {L"\U0001f1e6\U00000020", {127462, 32}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000020", {127462, 32}, {2, 3}}, - {L"\U0001f1e6\U0000000d", {127462, 13}, {1, 2}}, - {L"\U0001f1e6\U00000308\U0000000d", {127462, 13}, {2, 3}}, - {L"\U0001f1e6\U0000000a", {127462, 10}, {1, 2}}, - {L"\U0001f1e6\U00000308\U0000000a", {127462, 10}, {2, 3}}, - {L"\U0001f1e6\U00000001", {127462, 1}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000001", {127462, 1}, {2, 3}}, - {L"\U0001f1e6\U0000200c", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U0000200c", {127462}, {3}}, - {L"\U0001f1e6\U0001f1e6", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U0001f1e6", {127462, 127462}, {2, 3}}, - {L"\U0001f1e6\U00000600", {127462, 1536}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000600", {127462, 1536}, {2, 3}}, - {L"\U0001f1e6\U00000a03", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U00000a03", {127462}, {3}}, - {L"\U0001f1e6\U00001100", {127462, 4352}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00001100", {127462, 4352}, {2, 3}}, - {L"\U0001f1e6\U00001160", {127462, 4448}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00001160", {127462, 4448}, {2, 3}}, - {L"\U0001f1e6\U000011a8", {127462, 4520}, {1, 2}}, - {L"\U0001f1e6\U00000308\U000011a8", {127462, 4520}, {2, 3}}, - {L"\U0001f1e6\U0000ac00", {127462, 44032}, {1, 2}}, - {L"\U0001f1e6\U00000308\U0000ac00", {127462, 44032}, {2, 3}}, - {L"\U0001f1e6\U0000ac01", {127462, 44033}, {1, 2}}, - {L"\U0001f1e6\U00000308\U0000ac01", {127462, 44033}, {2, 3}}, - {L"\U0001f1e6\U00000903", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U00000903", {127462}, {3}}, - {L"\U0001f1e6\U00000904", {127462, 2308}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000904", {127462, 2308}, {2, 3}}, - {L"\U0001f1e6\U00000d4e", {127462, 3406}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000d4e", {127462, 3406}, {2, 3}}, - {L"\U0001f1e6\U00000915", {127462, 2325}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000915", {127462, 2325}, {2, 3}}, - {L"\U0001f1e6\U0000231a", {127462, 8986}, {1, 2}}, - {L"\U0001f1e6\U00000308\U0000231a", {127462, 8986}, {2, 3}}, - {L"\U0001f1e6\U00000300", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U00000300", {127462}, {3}}, - {L"\U0001f1e6\U00000900", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U00000900", {127462}, {3}}, - {L"\U0001f1e6\U0000094d", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U0000094d", {127462}, {3}}, - {L"\U0001f1e6\U0000200d", {127462}, {2}}, - {L"\U0001f1e6\U00000308\U0000200d", {127462}, {3}}, - {L"\U0001f1e6\U00000378", {127462, 888}, {1, 2}}, - {L"\U0001f1e6\U00000308\U00000378", {127462, 888}, {2, 3}}, - {L"\U00000600\U00000020", {1536}, {2}}, - {L"\U00000600\U00000308\U00000020", {1536, 32}, {2, 3}}, - {L"\U00000600\U0000000d", {1536, 13}, {1, 2}}, - {L"\U00000600\U00000308\U0000000d", {1536, 13}, {2, 3}}, - {L"\U00000600\U0000000a", {1536, 10}, {1, 2}}, - {L"\U00000600\U00000308\U0000000a", {1536, 10}, {2, 3}}, - {L"\U00000600\U00000001", {1536, 1}, {1, 2}}, - {L"\U00000600\U00000308\U00000001", {1536, 1}, {2, 3}}, - {L"\U00000600\U0000200c", {1536}, {2}}, - {L"\U00000600\U00000308\U0000200c", {1536}, {3}}, - {L"\U00000600\U0001f1e6", {1536}, {2}}, - {L"\U00000600\U00000308\U0001f1e6", {1536, 127462}, {2, 3}}, - {L"\U00000600\U00000600", {1536}, {2}}, - {L"\U00000600\U00000308\U00000600", {1536, 1536}, {2, 3}}, - {L"\U00000600\U00000a03", {1536}, {2}}, - {L"\U00000600\U00000308\U00000a03", {1536}, {3}}, - {L"\U00000600\U00001100", {1536}, {2}}, - {L"\U00000600\U00000308\U00001100", {1536, 4352}, {2, 3}}, - {L"\U00000600\U00001160", {1536}, {2}}, - {L"\U00000600\U00000308\U00001160", {1536, 4448}, {2, 3}}, - {L"\U00000600\U000011a8", {1536}, {2}}, - {L"\U00000600\U00000308\U000011a8", {1536, 4520}, {2, 3}}, - {L"\U00000600\U0000ac00", {1536}, {2}}, - {L"\U00000600\U00000308\U0000ac00", {1536, 44032}, {2, 3}}, - {L"\U00000600\U0000ac01", {1536}, {2}}, - {L"\U00000600\U00000308\U0000ac01", {1536, 44033}, {2, 3}}, - {L"\U00000600\U00000903", {1536}, {2}}, - {L"\U00000600\U00000308\U00000903", {1536}, {3}}, - {L"\U00000600\U00000904", {1536}, {2}}, - {L"\U00000600\U00000308\U00000904", {1536, 2308}, {2, 3}}, - {L"\U00000600\U00000d4e", {1536}, {2}}, - {L"\U00000600\U00000308\U00000d4e", {1536, 3406}, {2, 3}}, - {L"\U00000600\U00000915", {1536}, {2}}, - {L"\U00000600\U00000308\U00000915", {1536, 2325}, {2, 3}}, - {L"\U00000600\U0000231a", {1536}, {2}}, - {L"\U00000600\U00000308\U0000231a", {1536, 8986}, {2, 3}}, - {L"\U00000600\U00000300", {1536}, {2}}, - {L"\U00000600\U00000308\U00000300", {1536}, {3}}, - {L"\U00000600\U00000900", {1536}, {2}}, - {L"\U00000600\U00000308\U00000900", {1536}, {3}}, - {L"\U00000600\U0000094d", {1536}, {2}}, - {L"\U00000600\U00000308\U0000094d", {1536}, {3}}, - {L"\U00000600\U0000200d", {1536}, {2}}, - {L"\U00000600\U00000308\U0000200d", {1536}, {3}}, - {L"\U00000600\U00000378", {1536}, {2}}, - {L"\U00000600\U00000308\U00000378", {1536, 888}, {2, 3}}, - {L"\U00000a03\U00000020", {2563, 32}, {1, 2}}, - {L"\U00000a03\U00000308\U00000020", {2563, 32}, {2, 3}}, - {L"\U00000a03\U0000000d", {2563, 13}, {1, 2}}, - {L"\U00000a03\U00000308\U0000000d", {2563, 13}, {2, 3}}, - {L"\U00000a03\U0000000a", {2563, 10}, {1, 2}}, - {L"\U00000a03\U00000308\U0000000a", {2563, 10}, {2, 3}}, - {L"\U00000a03\U00000001", {2563, 1}, {1, 2}}, - {L"\U00000a03\U00000308\U00000001", {2563, 1}, {2, 3}}, - {L"\U00000a03\U0000200c", {2563}, {2}}, - {L"\U00000a03\U00000308\U0000200c", {2563}, {3}}, - {L"\U00000a03\U0001f1e6", {2563, 127462}, {1, 2}}, - {L"\U00000a03\U00000308\U0001f1e6", {2563, 127462}, {2, 3}}, - {L"\U00000a03\U00000600", {2563, 1536}, {1, 2}}, - {L"\U00000a03\U00000308\U00000600", {2563, 1536}, {2, 3}}, - {L"\U00000a03\U00000a03", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000a03", {2563}, {3}}, - {L"\U00000a03\U00001100", {2563, 4352}, {1, 2}}, - {L"\U00000a03\U00000308\U00001100", {2563, 4352}, {2, 3}}, - {L"\U00000a03\U00001160", {2563, 4448}, {1, 2}}, - {L"\U00000a03\U00000308\U00001160", {2563, 4448}, {2, 3}}, - {L"\U00000a03\U000011a8", {2563, 4520}, {1, 2}}, - {L"\U00000a03\U00000308\U000011a8", {2563, 4520}, {2, 3}}, - {L"\U00000a03\U0000ac00", {2563, 44032}, {1, 2}}, - {L"\U00000a03\U00000308\U0000ac00", {2563, 44032}, {2, 3}}, - {L"\U00000a03\U0000ac01", {2563, 44033}, {1, 2}}, - {L"\U00000a03\U00000308\U0000ac01", {2563, 44033}, {2, 3}}, - {L"\U00000a03\U00000903", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000903", {2563}, {3}}, - {L"\U00000a03\U00000904", {2563, 2308}, {1, 2}}, - {L"\U00000a03\U00000308\U00000904", {2563, 2308}, {2, 3}}, - {L"\U00000a03\U00000d4e", {2563, 3406}, {1, 2}}, - {L"\U00000a03\U00000308\U00000d4e", {2563, 3406}, {2, 3}}, - {L"\U00000a03\U00000915", {2563, 2325}, {1, 2}}, - {L"\U00000a03\U00000308\U00000915", {2563, 2325}, {2, 3}}, - {L"\U00000a03\U0000231a", {2563, 8986}, {1, 2}}, - {L"\U00000a03\U00000308\U0000231a", {2563, 8986}, {2, 3}}, - {L"\U00000a03\U00000300", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000300", {2563}, {3}}, - {L"\U00000a03\U00000900", {2563}, {2}}, - {L"\U00000a03\U00000308\U00000900", {2563}, {3}}, - {L"\U00000a03\U0000094d", {2563}, {2}}, - {L"\U00000a03\U00000308\U0000094d", {2563}, {3}}, - {L"\U00000a03\U0000200d", {2563}, {2}}, - {L"\U00000a03\U00000308\U0000200d", {2563}, {3}}, - {L"\U00000a03\U00000378", {2563, 888}, {1, 2}}, - {L"\U00000a03\U00000308\U00000378", {2563, 888}, {2, 3}}, - {L"\U00001100\U00000020", {4352, 32}, {1, 2}}, - {L"\U00001100\U00000308\U00000020", {4352, 32}, {2, 3}}, - {L"\U00001100\U0000000d", {4352, 13}, {1, 2}}, - {L"\U00001100\U00000308\U0000000d", {4352, 13}, {2, 3}}, - {L"\U00001100\U0000000a", {4352, 10}, {1, 2}}, - {L"\U00001100\U00000308\U0000000a", {4352, 10}, {2, 3}}, - {L"\U00001100\U00000001", {4352, 1}, {1, 2}}, - {L"\U00001100\U00000308\U00000001", {4352, 1}, {2, 3}}, - {L"\U00001100\U0000200c", {4352}, {2}}, - {L"\U00001100\U00000308\U0000200c", {4352}, {3}}, - {L"\U00001100\U0001f1e6", {4352, 127462}, {1, 2}}, - {L"\U00001100\U00000308\U0001f1e6", {4352, 127462}, {2, 3}}, - {L"\U00001100\U00000600", {4352, 1536}, {1, 2}}, - {L"\U00001100\U00000308\U00000600", {4352, 1536}, {2, 3}}, - {L"\U00001100\U00000a03", {4352}, {2}}, - {L"\U00001100\U00000308\U00000a03", {4352}, {3}}, - {L"\U00001100\U00001100", {4352}, {2}}, - {L"\U00001100\U00000308\U00001100", {4352, 4352}, {2, 3}}, - {L"\U00001100\U00001160", {4352}, {2}}, - {L"\U00001100\U00000308\U00001160", {4352, 4448}, {2, 3}}, - {L"\U00001100\U000011a8", {4352, 4520}, {1, 2}}, - {L"\U00001100\U00000308\U000011a8", {4352, 4520}, {2, 3}}, - {L"\U00001100\U0000ac00", {4352}, {2}}, - {L"\U00001100\U00000308\U0000ac00", {4352, 44032}, {2, 3}}, - {L"\U00001100\U0000ac01", {4352}, {2}}, - {L"\U00001100\U00000308\U0000ac01", {4352, 44033}, {2, 3}}, - {L"\U00001100\U00000903", {4352}, {2}}, - {L"\U00001100\U00000308\U00000903", {4352}, {3}}, - {L"\U00001100\U00000904", {4352, 2308}, {1, 2}}, - {L"\U00001100\U00000308\U00000904", {4352, 2308}, {2, 3}}, - {L"\U00001100\U00000d4e", {4352, 3406}, {1, 2}}, - {L"\U00001100\U00000308\U00000d4e", {4352, 3406}, {2, 3}}, - {L"\U00001100\U00000915", {4352, 2325}, {1, 2}}, - {L"\U00001100\U00000308\U00000915", {4352, 2325}, {2, 3}}, - {L"\U00001100\U0000231a", {4352, 8986}, {1, 2}}, - {L"\U00001100\U00000308\U0000231a", {4352, 8986}, {2, 3}}, - {L"\U00001100\U00000300", {4352}, {2}}, - {L"\U00001100\U00000308\U00000300", {4352}, {3}}, - {L"\U00001100\U00000900", {4352}, {2}}, - {L"\U00001100\U00000308\U00000900", {4352}, {3}}, - {L"\U00001100\U0000094d", {4352}, {2}}, - {L"\U00001100\U00000308\U0000094d", {4352}, {3}}, - {L"\U00001100\U0000200d", {4352}, {2}}, - {L"\U00001100\U00000308\U0000200d", {4352}, {3}}, - {L"\U00001100\U00000378", {4352, 888}, {1, 2}}, - {L"\U00001100\U00000308\U00000378", {4352, 888}, {2, 3}}, - {L"\U00001160\U00000020", {4448, 32}, {1, 2}}, - {L"\U00001160\U00000308\U00000020", {4448, 32}, {2, 3}}, - {L"\U00001160\U0000000d", {4448, 13}, {1, 2}}, - {L"\U00001160\U00000308\U0000000d", {4448, 13}, {2, 3}}, - {L"\U00001160\U0000000a", {4448, 10}, {1, 2}}, - {L"\U00001160\U00000308\U0000000a", {4448, 10}, {2, 3}}, - {L"\U00001160\U00000001", {4448, 1}, {1, 2}}, - {L"\U00001160\U00000308\U00000001", {4448, 1}, {2, 3}}, - {L"\U00001160\U0000200c", {4448}, {2}}, - {L"\U00001160\U00000308\U0000200c", {4448}, {3}}, - {L"\U00001160\U0001f1e6", {4448, 127462}, {1, 2}}, - {L"\U00001160\U00000308\U0001f1e6", {4448, 127462}, {2, 3}}, - {L"\U00001160\U00000600", {4448, 1536}, {1, 2}}, - {L"\U00001160\U00000308\U00000600", {4448, 1536}, {2, 3}}, - {L"\U00001160\U00000a03", {4448}, {2}}, - {L"\U00001160\U00000308\U00000a03", {4448}, {3}}, - {L"\U00001160\U00001100", {4448, 4352}, {1, 2}}, - {L"\U00001160\U00000308\U00001100", {4448, 4352}, {2, 3}}, - {L"\U00001160\U00001160", {4448}, {2}}, - {L"\U00001160\U00000308\U00001160", {4448, 4448}, {2, 3}}, - {L"\U00001160\U000011a8", {4448}, {2}}, - {L"\U00001160\U00000308\U000011a8", {4448, 4520}, {2, 3}}, - {L"\U00001160\U0000ac00", {4448, 44032}, {1, 2}}, - {L"\U00001160\U00000308\U0000ac00", {4448, 44032}, {2, 3}}, - {L"\U00001160\U0000ac01", {4448, 44033}, {1, 2}}, - {L"\U00001160\U00000308\U0000ac01", {4448, 44033}, {2, 3}}, - {L"\U00001160\U00000903", {4448}, {2}}, - {L"\U00001160\U00000308\U00000903", {4448}, {3}}, - {L"\U00001160\U00000904", {4448, 2308}, {1, 2}}, - {L"\U00001160\U00000308\U00000904", {4448, 2308}, {2, 3}}, - {L"\U00001160\U00000d4e", {4448, 3406}, {1, 2}}, - {L"\U00001160\U00000308\U00000d4e", {4448, 3406}, {2, 3}}, - {L"\U00001160\U00000915", {4448, 2325}, {1, 2}}, - {L"\U00001160\U00000308\U00000915", {4448, 2325}, {2, 3}}, - {L"\U00001160\U0000231a", {4448, 8986}, {1, 2}}, - {L"\U00001160\U00000308\U0000231a", {4448, 8986}, {2, 3}}, - {L"\U00001160\U00000300", {4448}, {2}}, - {L"\U00001160\U00000308\U00000300", {4448}, {3}}, - {L"\U00001160\U00000900", {4448}, {2}}, - {L"\U00001160\U00000308\U00000900", {4448}, {3}}, - {L"\U00001160\U0000094d", {4448}, {2}}, - {L"\U00001160\U00000308\U0000094d", {4448}, {3}}, - {L"\U00001160\U0000200d", {4448}, {2}}, - {L"\U00001160\U00000308\U0000200d", {4448}, {3}}, - {L"\U00001160\U00000378", {4448, 888}, {1, 2}}, - {L"\U00001160\U00000308\U00000378", {4448, 888}, {2, 3}}, - {L"\U000011a8\U00000020", {4520, 32}, {1, 2}}, - {L"\U000011a8\U00000308\U00000020", {4520, 32}, {2, 3}}, - {L"\U000011a8\U0000000d", {4520, 13}, {1, 2}}, - {L"\U000011a8\U00000308\U0000000d", {4520, 13}, {2, 3}}, - {L"\U000011a8\U0000000a", {4520, 10}, {1, 2}}, - {L"\U000011a8\U00000308\U0000000a", {4520, 10}, {2, 3}}, - {L"\U000011a8\U00000001", {4520, 1}, {1, 2}}, - {L"\U000011a8\U00000308\U00000001", {4520, 1}, {2, 3}}, - {L"\U000011a8\U0000200c", {4520}, {2}}, - {L"\U000011a8\U00000308\U0000200c", {4520}, {3}}, - {L"\U000011a8\U0001f1e6", {4520, 127462}, {1, 2}}, - {L"\U000011a8\U00000308\U0001f1e6", {4520, 127462}, {2, 3}}, - {L"\U000011a8\U00000600", {4520, 1536}, {1, 2}}, - {L"\U000011a8\U00000308\U00000600", {4520, 1536}, {2, 3}}, - {L"\U000011a8\U00000a03", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000a03", {4520}, {3}}, - {L"\U000011a8\U00001100", {4520, 4352}, {1, 2}}, - {L"\U000011a8\U00000308\U00001100", {4520, 4352}, {2, 3}}, - {L"\U000011a8\U00001160", {4520, 4448}, {1, 2}}, - {L"\U000011a8\U00000308\U00001160", {4520, 4448}, {2, 3}}, - {L"\U000011a8\U000011a8", {4520}, {2}}, - {L"\U000011a8\U00000308\U000011a8", {4520, 4520}, {2, 3}}, - {L"\U000011a8\U0000ac00", {4520, 44032}, {1, 2}}, - {L"\U000011a8\U00000308\U0000ac00", {4520, 44032}, {2, 3}}, - {L"\U000011a8\U0000ac01", {4520, 44033}, {1, 2}}, - {L"\U000011a8\U00000308\U0000ac01", {4520, 44033}, {2, 3}}, - {L"\U000011a8\U00000903", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000903", {4520}, {3}}, - {L"\U000011a8\U00000904", {4520, 2308}, {1, 2}}, - {L"\U000011a8\U00000308\U00000904", {4520, 2308}, {2, 3}}, - {L"\U000011a8\U00000d4e", {4520, 3406}, {1, 2}}, - {L"\U000011a8\U00000308\U00000d4e", {4520, 3406}, {2, 3}}, - {L"\U000011a8\U00000915", {4520, 2325}, {1, 2}}, - {L"\U000011a8\U00000308\U00000915", {4520, 2325}, {2, 3}}, - {L"\U000011a8\U0000231a", {4520, 8986}, {1, 2}}, - {L"\U000011a8\U00000308\U0000231a", {4520, 8986}, {2, 3}}, - {L"\U000011a8\U00000300", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000300", {4520}, {3}}, - {L"\U000011a8\U00000900", {4520}, {2}}, - {L"\U000011a8\U00000308\U00000900", {4520}, {3}}, - {L"\U000011a8\U0000094d", {4520}, {2}}, - {L"\U000011a8\U00000308\U0000094d", {4520}, {3}}, - {L"\U000011a8\U0000200d", {4520}, {2}}, - {L"\U000011a8\U00000308\U0000200d", {4520}, {3}}, - {L"\U000011a8\U00000378", {4520, 888}, {1, 2}}, - {L"\U000011a8\U00000308\U00000378", {4520, 888}, {2, 3}}, - {L"\U0000ac00\U00000020", {44032, 32}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000020", {44032, 32}, {2, 3}}, - {L"\U0000ac00\U0000000d", {44032, 13}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000000d", {44032, 13}, {2, 3}}, - {L"\U0000ac00\U0000000a", {44032, 10}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000000a", {44032, 10}, {2, 3}}, - {L"\U0000ac00\U00000001", {44032, 1}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000001", {44032, 1}, {2, 3}}, - {L"\U0000ac00\U0000200c", {44032}, {2}}, - {L"\U0000ac00\U00000308\U0000200c", {44032}, {3}}, - {L"\U0000ac00\U0001f1e6", {44032, 127462}, {1, 2}}, - {L"\U0000ac00\U00000308\U0001f1e6", {44032, 127462}, {2, 3}}, - {L"\U0000ac00\U00000600", {44032, 1536}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000600", {44032, 1536}, {2, 3}}, - {L"\U0000ac00\U00000a03", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000a03", {44032}, {3}}, - {L"\U0000ac00\U00001100", {44032, 4352}, {1, 2}}, - {L"\U0000ac00\U00000308\U00001100", {44032, 4352}, {2, 3}}, - {L"\U0000ac00\U00001160", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00001160", {44032, 4448}, {2, 3}}, - {L"\U0000ac00\U000011a8", {44032}, {2}}, - {L"\U0000ac00\U00000308\U000011a8", {44032, 4520}, {2, 3}}, - {L"\U0000ac00\U0000ac00", {44032, 44032}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000ac00", {44032, 44032}, {2, 3}}, - {L"\U0000ac00\U0000ac01", {44032, 44033}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000ac01", {44032, 44033}, {2, 3}}, - {L"\U0000ac00\U00000903", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000903", {44032}, {3}}, - {L"\U0000ac00\U00000904", {44032, 2308}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000904", {44032, 2308}, {2, 3}}, - {L"\U0000ac00\U00000d4e", {44032, 3406}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000d4e", {44032, 3406}, {2, 3}}, - {L"\U0000ac00\U00000915", {44032, 2325}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000915", {44032, 2325}, {2, 3}}, - {L"\U0000ac00\U0000231a", {44032, 8986}, {1, 2}}, - {L"\U0000ac00\U00000308\U0000231a", {44032, 8986}, {2, 3}}, - {L"\U0000ac00\U00000300", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000300", {44032}, {3}}, - {L"\U0000ac00\U00000900", {44032}, {2}}, - {L"\U0000ac00\U00000308\U00000900", {44032}, {3}}, - {L"\U0000ac00\U0000094d", {44032}, {2}}, - {L"\U0000ac00\U00000308\U0000094d", {44032}, {3}}, - {L"\U0000ac00\U0000200d", {44032}, {2}}, - {L"\U0000ac00\U00000308\U0000200d", {44032}, {3}}, - {L"\U0000ac00\U00000378", {44032, 888}, {1, 2}}, - {L"\U0000ac00\U00000308\U00000378", {44032, 888}, {2, 3}}, - {L"\U0000ac01\U00000020", {44033, 32}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000020", {44033, 32}, {2, 3}}, - {L"\U0000ac01\U0000000d", {44033, 13}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000000d", {44033, 13}, {2, 3}}, - {L"\U0000ac01\U0000000a", {44033, 10}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000000a", {44033, 10}, {2, 3}}, - {L"\U0000ac01\U00000001", {44033, 1}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000001", {44033, 1}, {2, 3}}, - {L"\U0000ac01\U0000200c", {44033}, {2}}, - {L"\U0000ac01\U00000308\U0000200c", {44033}, {3}}, - {L"\U0000ac01\U0001f1e6", {44033, 127462}, {1, 2}}, - {L"\U0000ac01\U00000308\U0001f1e6", {44033, 127462}, {2, 3}}, - {L"\U0000ac01\U00000600", {44033, 1536}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000600", {44033, 1536}, {2, 3}}, - {L"\U0000ac01\U00000a03", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000a03", {44033}, {3}}, - {L"\U0000ac01\U00001100", {44033, 4352}, {1, 2}}, - {L"\U0000ac01\U00000308\U00001100", {44033, 4352}, {2, 3}}, - {L"\U0000ac01\U00001160", {44033, 4448}, {1, 2}}, - {L"\U0000ac01\U00000308\U00001160", {44033, 4448}, {2, 3}}, - {L"\U0000ac01\U000011a8", {44033}, {2}}, - {L"\U0000ac01\U00000308\U000011a8", {44033, 4520}, {2, 3}}, - {L"\U0000ac01\U0000ac00", {44033, 44032}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000ac00", {44033, 44032}, {2, 3}}, - {L"\U0000ac01\U0000ac01", {44033, 44033}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000ac01", {44033, 44033}, {2, 3}}, - {L"\U0000ac01\U00000903", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000903", {44033}, {3}}, - {L"\U0000ac01\U00000904", {44033, 2308}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000904", {44033, 2308}, {2, 3}}, - {L"\U0000ac01\U00000d4e", {44033, 3406}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000d4e", {44033, 3406}, {2, 3}}, - {L"\U0000ac01\U00000915", {44033, 2325}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000915", {44033, 2325}, {2, 3}}, - {L"\U0000ac01\U0000231a", {44033, 8986}, {1, 2}}, - {L"\U0000ac01\U00000308\U0000231a", {44033, 8986}, {2, 3}}, - {L"\U0000ac01\U00000300", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000300", {44033}, {3}}, - {L"\U0000ac01\U00000900", {44033}, {2}}, - {L"\U0000ac01\U00000308\U00000900", {44033}, {3}}, - {L"\U0000ac01\U0000094d", {44033}, {2}}, - {L"\U0000ac01\U00000308\U0000094d", {44033}, {3}}, - {L"\U0000ac01\U0000200d", {44033}, {2}}, - {L"\U0000ac01\U00000308\U0000200d", {44033}, {3}}, - {L"\U0000ac01\U00000378", {44033, 888}, {1, 2}}, - {L"\U0000ac01\U00000308\U00000378", {44033, 888}, {2, 3}}, - {L"\U00000903\U00000020", {2307, 32}, {1, 2}}, - {L"\U00000903\U00000308\U00000020", {2307, 32}, {2, 3}}, - {L"\U00000903\U0000000d", {2307, 13}, {1, 2}}, - {L"\U00000903\U00000308\U0000000d", {2307, 13}, {2, 3}}, - {L"\U00000903\U0000000a", {2307, 10}, {1, 2}}, - {L"\U00000903\U00000308\U0000000a", {2307, 10}, {2, 3}}, - {L"\U00000903\U00000001", {2307, 1}, {1, 2}}, - {L"\U00000903\U00000308\U00000001", {2307, 1}, {2, 3}}, - {L"\U00000903\U0000200c", {2307}, {2}}, - {L"\U00000903\U00000308\U0000200c", {2307}, {3}}, - {L"\U00000903\U0001f1e6", {2307, 127462}, {1, 2}}, - {L"\U00000903\U00000308\U0001f1e6", {2307, 127462}, {2, 3}}, - {L"\U00000903\U00000600", {2307, 1536}, {1, 2}}, - {L"\U00000903\U00000308\U00000600", {2307, 1536}, {2, 3}}, - {L"\U00000903\U00000a03", {2307}, {2}}, - {L"\U00000903\U00000308\U00000a03", {2307}, {3}}, - {L"\U00000903\U00001100", {2307, 4352}, {1, 2}}, - {L"\U00000903\U00000308\U00001100", {2307, 4352}, {2, 3}}, - {L"\U00000903\U00001160", {2307, 4448}, {1, 2}}, - {L"\U00000903\U00000308\U00001160", {2307, 4448}, {2, 3}}, - {L"\U00000903\U000011a8", {2307, 4520}, {1, 2}}, - {L"\U00000903\U00000308\U000011a8", {2307, 4520}, {2, 3}}, - {L"\U00000903\U0000ac00", {2307, 44032}, {1, 2}}, - {L"\U00000903\U00000308\U0000ac00", {2307, 44032}, {2, 3}}, - {L"\U00000903\U0000ac01", {2307, 44033}, {1, 2}}, - {L"\U00000903\U00000308\U0000ac01", {2307, 44033}, {2, 3}}, - {L"\U00000903\U00000903", {2307}, {2}}, - {L"\U00000903\U00000308\U00000903", {2307}, {3}}, - {L"\U00000903\U00000904", {2307, 2308}, {1, 2}}, - {L"\U00000903\U00000308\U00000904", {2307, 2308}, {2, 3}}, - {L"\U00000903\U00000d4e", {2307, 3406}, {1, 2}}, - {L"\U00000903\U00000308\U00000d4e", {2307, 3406}, {2, 3}}, - {L"\U00000903\U00000915", {2307, 2325}, {1, 2}}, - {L"\U00000903\U00000308\U00000915", {2307, 2325}, {2, 3}}, - {L"\U00000903\U0000231a", {2307, 8986}, {1, 2}}, - {L"\U00000903\U00000308\U0000231a", {2307, 8986}, {2, 3}}, - {L"\U00000903\U00000300", {2307}, {2}}, - {L"\U00000903\U00000308\U00000300", {2307}, {3}}, - {L"\U00000903\U00000900", {2307}, {2}}, - {L"\U00000903\U00000308\U00000900", {2307}, {3}}, - {L"\U00000903\U0000094d", {2307}, {2}}, - {L"\U00000903\U00000308\U0000094d", {2307}, {3}}, - {L"\U00000903\U0000200d", {2307}, {2}}, - {L"\U00000903\U00000308\U0000200d", {2307}, {3}}, - {L"\U00000903\U00000378", {2307, 888}, {1, 2}}, - {L"\U00000903\U00000308\U00000378", {2307, 888}, {2, 3}}, - {L"\U00000904\U00000020", {2308, 32}, {1, 2}}, - {L"\U00000904\U00000308\U00000020", {2308, 32}, {2, 3}}, - {L"\U00000904\U0000000d", {2308, 13}, {1, 2}}, - {L"\U00000904\U00000308\U0000000d", {2308, 13}, {2, 3}}, - {L"\U00000904\U0000000a", {2308, 10}, {1, 2}}, - {L"\U00000904\U00000308\U0000000a", {2308, 10}, {2, 3}}, - {L"\U00000904\U00000001", {2308, 1}, {1, 2}}, - {L"\U00000904\U00000308\U00000001", {2308, 1}, {2, 3}}, - {L"\U00000904\U0000200c", {2308}, {2}}, - {L"\U00000904\U00000308\U0000200c", {2308}, {3}}, - {L"\U00000904\U0001f1e6", {2308, 127462}, {1, 2}}, - {L"\U00000904\U00000308\U0001f1e6", {2308, 127462}, {2, 3}}, - {L"\U00000904\U00000600", {2308, 1536}, {1, 2}}, - {L"\U00000904\U00000308\U00000600", {2308, 1536}, {2, 3}}, - {L"\U00000904\U00000a03", {2308}, {2}}, - {L"\U00000904\U00000308\U00000a03", {2308}, {3}}, - {L"\U00000904\U00001100", {2308, 4352}, {1, 2}}, - {L"\U00000904\U00000308\U00001100", {2308, 4352}, {2, 3}}, - {L"\U00000904\U00001160", {2308, 4448}, {1, 2}}, - {L"\U00000904\U00000308\U00001160", {2308, 4448}, {2, 3}}, - {L"\U00000904\U000011a8", {2308, 4520}, {1, 2}}, - {L"\U00000904\U00000308\U000011a8", {2308, 4520}, {2, 3}}, - {L"\U00000904\U0000ac00", {2308, 44032}, {1, 2}}, - {L"\U00000904\U00000308\U0000ac00", {2308, 44032}, {2, 3}}, - {L"\U00000904\U0000ac01", {2308, 44033}, {1, 2}}, - {L"\U00000904\U00000308\U0000ac01", {2308, 44033}, {2, 3}}, - {L"\U00000904\U00000903", {2308}, {2}}, - {L"\U00000904\U00000308\U00000903", {2308}, {3}}, - {L"\U00000904\U00000904", {2308, 2308}, {1, 2}}, - {L"\U00000904\U00000308\U00000904", {2308, 2308}, {2, 3}}, - {L"\U00000904\U00000d4e", {2308, 3406}, {1, 2}}, - {L"\U00000904\U00000308\U00000d4e", {2308, 3406}, {2, 3}}, - {L"\U00000904\U00000915", {2308, 2325}, {1, 2}}, - {L"\U00000904\U00000308\U00000915", {2308, 2325}, {2, 3}}, - {L"\U00000904\U0000231a", {2308, 8986}, {1, 2}}, - {L"\U00000904\U00000308\U0000231a", {2308, 8986}, {2, 3}}, - {L"\U00000904\U00000300", {2308}, {2}}, - {L"\U00000904\U00000308\U00000300", {2308}, {3}}, - {L"\U00000904\U00000900", {2308}, {2}}, - {L"\U00000904\U00000308\U00000900", {2308}, {3}}, - {L"\U00000904\U0000094d", {2308}, {2}}, - {L"\U00000904\U00000308\U0000094d", {2308}, {3}}, - {L"\U00000904\U0000200d", {2308}, {2}}, - {L"\U00000904\U00000308\U0000200d", {2308}, {3}}, - {L"\U00000904\U00000378", {2308, 888}, {1, 2}}, - {L"\U00000904\U00000308\U00000378", {2308, 888}, {2, 3}}, - {L"\U00000d4e\U00000020", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000020", {3406, 32}, {2, 3}}, - {L"\U00000d4e\U0000000d", {3406, 13}, {1, 2}}, - {L"\U00000d4e\U00000308\U0000000d", {3406, 13}, {2, 3}}, - {L"\U00000d4e\U0000000a", {3406, 10}, {1, 2}}, - {L"\U00000d4e\U00000308\U0000000a", {3406, 10}, {2, 3}}, - {L"\U00000d4e\U00000001", {3406, 1}, {1, 2}}, - {L"\U00000d4e\U00000308\U00000001", {3406, 1}, {2, 3}}, - {L"\U00000d4e\U0000200c", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000200c", {3406}, {3}}, - {L"\U00000d4e\U0001f1e6", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0001f1e6", {3406, 127462}, {2, 3}}, - {L"\U00000d4e\U00000600", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000600", {3406, 1536}, {2, 3}}, - {L"\U00000d4e\U00000a03", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000a03", {3406}, {3}}, - {L"\U00000d4e\U00001100", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00001100", {3406, 4352}, {2, 3}}, - {L"\U00000d4e\U00001160", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00001160", {3406, 4448}, {2, 3}}, - {L"\U00000d4e\U000011a8", {3406}, {2}}, - {L"\U00000d4e\U00000308\U000011a8", {3406, 4520}, {2, 3}}, - {L"\U00000d4e\U0000ac00", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000ac00", {3406, 44032}, {2, 3}}, - {L"\U00000d4e\U0000ac01", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000ac01", {3406, 44033}, {2, 3}}, - {L"\U00000d4e\U00000903", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000903", {3406}, {3}}, - {L"\U00000d4e\U00000904", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000904", {3406, 2308}, {2, 3}}, - {L"\U00000d4e\U00000d4e", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000d4e", {3406, 3406}, {2, 3}}, - {L"\U00000d4e\U00000915", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000915", {3406, 2325}, {2, 3}}, - {L"\U00000d4e\U0000231a", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000231a", {3406, 8986}, {2, 3}}, - {L"\U00000d4e\U00000300", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000300", {3406}, {3}}, - {L"\U00000d4e\U00000900", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000900", {3406}, {3}}, - {L"\U00000d4e\U0000094d", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000094d", {3406}, {3}}, - {L"\U00000d4e\U0000200d", {3406}, {2}}, - {L"\U00000d4e\U00000308\U0000200d", {3406}, {3}}, - {L"\U00000d4e\U00000378", {3406}, {2}}, - {L"\U00000d4e\U00000308\U00000378", {3406, 888}, {2, 3}}, - {L"\U00000915\U00000020", {2325, 32}, {1, 2}}, - {L"\U00000915\U00000308\U00000020", {2325, 32}, {2, 3}}, - {L"\U00000915\U0000000d", {2325, 13}, {1, 2}}, - {L"\U00000915\U00000308\U0000000d", {2325, 13}, {2, 3}}, - {L"\U00000915\U0000000a", {2325, 10}, {1, 2}}, - {L"\U00000915\U00000308\U0000000a", {2325, 10}, {2, 3}}, - {L"\U00000915\U00000001", {2325, 1}, {1, 2}}, - {L"\U00000915\U00000308\U00000001", {2325, 1}, {2, 3}}, - {L"\U00000915\U0000200c", {2325}, {2}}, - {L"\U00000915\U00000308\U0000200c", {2325}, {3}}, - {L"\U00000915\U0001f1e6", {2325, 127462}, {1, 2}}, - {L"\U00000915\U00000308\U0001f1e6", {2325, 127462}, {2, 3}}, - {L"\U00000915\U00000600", {2325, 1536}, {1, 2}}, - {L"\U00000915\U00000308\U00000600", {2325, 1536}, {2, 3}}, - {L"\U00000915\U00000a03", {2325}, {2}}, - {L"\U00000915\U00000308\U00000a03", {2325}, {3}}, - {L"\U00000915\U00001100", {2325, 4352}, {1, 2}}, - {L"\U00000915\U00000308\U00001100", {2325, 4352}, {2, 3}}, - {L"\U00000915\U00001160", {2325, 4448}, {1, 2}}, - {L"\U00000915\U00000308\U00001160", {2325, 4448}, {2, 3}}, - {L"\U00000915\U000011a8", {2325, 4520}, {1, 2}}, - {L"\U00000915\U00000308\U000011a8", {2325, 4520}, {2, 3}}, - {L"\U00000915\U0000ac00", {2325, 44032}, {1, 2}}, - {L"\U00000915\U00000308\U0000ac00", {2325, 44032}, {2, 3}}, - {L"\U00000915\U0000ac01", {2325, 44033}, {1, 2}}, - {L"\U00000915\U00000308\U0000ac01", {2325, 44033}, {2, 3}}, - {L"\U00000915\U00000903", {2325}, {2}}, - {L"\U00000915\U00000308\U00000903", {2325}, {3}}, - {L"\U00000915\U00000904", {2325, 2308}, {1, 2}}, - {L"\U00000915\U00000308\U00000904", {2325, 2308}, {2, 3}}, - {L"\U00000915\U00000d4e", {2325, 3406}, {1, 2}}, - {L"\U00000915\U00000308\U00000d4e", {2325, 3406}, {2, 3}}, - {L"\U00000915\U00000915", {2325, 2325}, {1, 2}}, - {L"\U00000915\U00000308\U00000915", {2325, 2325}, {2, 3}}, - {L"\U00000915\U0000231a", {2325, 8986}, {1, 2}}, - {L"\U00000915\U00000308\U0000231a", {2325, 8986}, {2, 3}}, - {L"\U00000915\U00000300", {2325}, {2}}, - {L"\U00000915\U00000308\U00000300", {2325}, {3}}, - {L"\U00000915\U00000900", {2325}, {2}}, - {L"\U00000915\U00000308\U00000900", {2325}, {3}}, - {L"\U00000915\U0000094d", {2325}, {2}}, - {L"\U00000915\U00000308\U0000094d", {2325}, {3}}, - {L"\U00000915\U0000200d", {2325}, {2}}, - {L"\U00000915\U00000308\U0000200d", {2325}, {3}}, - {L"\U00000915\U00000378", {2325, 888}, {1, 2}}, - {L"\U00000915\U00000308\U00000378", {2325, 888}, {2, 3}}, - {L"\U0000231a\U00000020", {8986, 32}, {1, 2}}, - {L"\U0000231a\U00000308\U00000020", {8986, 32}, {2, 3}}, - {L"\U0000231a\U0000000d", {8986, 13}, {1, 2}}, - {L"\U0000231a\U00000308\U0000000d", {8986, 13}, {2, 3}}, - {L"\U0000231a\U0000000a", {8986, 10}, {1, 2}}, - {L"\U0000231a\U00000308\U0000000a", {8986, 10}, {2, 3}}, - {L"\U0000231a\U00000001", {8986, 1}, {1, 2}}, - {L"\U0000231a\U00000308\U00000001", {8986, 1}, {2, 3}}, - {L"\U0000231a\U0000200c", {8986}, {2}}, - {L"\U0000231a\U00000308\U0000200c", {8986}, {3}}, - {L"\U0000231a\U0001f1e6", {8986, 127462}, {1, 2}}, - {L"\U0000231a\U00000308\U0001f1e6", {8986, 127462}, {2, 3}}, - {L"\U0000231a\U00000600", {8986, 1536}, {1, 2}}, - {L"\U0000231a\U00000308\U00000600", {8986, 1536}, {2, 3}}, - {L"\U0000231a\U00000a03", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000a03", {8986}, {3}}, - {L"\U0000231a\U00001100", {8986, 4352}, {1, 2}}, - {L"\U0000231a\U00000308\U00001100", {8986, 4352}, {2, 3}}, - {L"\U0000231a\U00001160", {8986, 4448}, {1, 2}}, - {L"\U0000231a\U00000308\U00001160", {8986, 4448}, {2, 3}}, - {L"\U0000231a\U000011a8", {8986, 4520}, {1, 2}}, - {L"\U0000231a\U00000308\U000011a8", {8986, 4520}, {2, 3}}, - {L"\U0000231a\U0000ac00", {8986, 44032}, {1, 2}}, - {L"\U0000231a\U00000308\U0000ac00", {8986, 44032}, {2, 3}}, - {L"\U0000231a\U0000ac01", {8986, 44033}, {1, 2}}, - {L"\U0000231a\U00000308\U0000ac01", {8986, 44033}, {2, 3}}, - {L"\U0000231a\U00000903", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000903", {8986}, {3}}, - {L"\U0000231a\U00000904", {8986, 2308}, {1, 2}}, - {L"\U0000231a\U00000308\U00000904", {8986, 2308}, {2, 3}}, - {L"\U0000231a\U00000d4e", {8986, 3406}, {1, 2}}, - {L"\U0000231a\U00000308\U00000d4e", {8986, 3406}, {2, 3}}, - {L"\U0000231a\U00000915", {8986, 2325}, {1, 2}}, - {L"\U0000231a\U00000308\U00000915", {8986, 2325}, {2, 3}}, - {L"\U0000231a\U0000231a", {8986, 8986}, {1, 2}}, - {L"\U0000231a\U00000308\U0000231a", {8986, 8986}, {2, 3}}, - {L"\U0000231a\U00000300", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000300", {8986}, {3}}, - {L"\U0000231a\U00000900", {8986}, {2}}, - {L"\U0000231a\U00000308\U00000900", {8986}, {3}}, - {L"\U0000231a\U0000094d", {8986}, {2}}, - {L"\U0000231a\U00000308\U0000094d", {8986}, {3}}, - {L"\U0000231a\U0000200d", {8986}, {2}}, - {L"\U0000231a\U00000308\U0000200d", {8986}, {3}}, - {L"\U0000231a\U00000378", {8986, 888}, {1, 2}}, - {L"\U0000231a\U00000308\U00000378", {8986, 888}, {2, 3}}, - {L"\U00000300\U00000020", {768, 32}, {1, 2}}, - {L"\U00000300\U00000308\U00000020", {768, 32}, {2, 3}}, - {L"\U00000300\U0000000d", {768, 13}, {1, 2}}, - {L"\U00000300\U00000308\U0000000d", {768, 13}, {2, 3}}, - {L"\U00000300\U0000000a", {768, 10}, {1, 2}}, - {L"\U00000300\U00000308\U0000000a", {768, 10}, {2, 3}}, - {L"\U00000300\U00000001", {768, 1}, {1, 2}}, - {L"\U00000300\U00000308\U00000001", {768, 1}, {2, 3}}, - {L"\U00000300\U0000200c", {768}, {2}}, - {L"\U00000300\U00000308\U0000200c", {768}, {3}}, - {L"\U00000300\U0001f1e6", {768, 127462}, {1, 2}}, - {L"\U00000300\U00000308\U0001f1e6", {768, 127462}, {2, 3}}, - {L"\U00000300\U00000600", {768, 1536}, {1, 2}}, - {L"\U00000300\U00000308\U00000600", {768, 1536}, {2, 3}}, - {L"\U00000300\U00000a03", {768}, {2}}, - {L"\U00000300\U00000308\U00000a03", {768}, {3}}, - {L"\U00000300\U00001100", {768, 4352}, {1, 2}}, - {L"\U00000300\U00000308\U00001100", {768, 4352}, {2, 3}}, - {L"\U00000300\U00001160", {768, 4448}, {1, 2}}, - {L"\U00000300\U00000308\U00001160", {768, 4448}, {2, 3}}, - {L"\U00000300\U000011a8", {768, 4520}, {1, 2}}, - {L"\U00000300\U00000308\U000011a8", {768, 4520}, {2, 3}}, - {L"\U00000300\U0000ac00", {768, 44032}, {1, 2}}, - {L"\U00000300\U00000308\U0000ac00", {768, 44032}, {2, 3}}, - {L"\U00000300\U0000ac01", {768, 44033}, {1, 2}}, - {L"\U00000300\U00000308\U0000ac01", {768, 44033}, {2, 3}}, - {L"\U00000300\U00000903", {768}, {2}}, - {L"\U00000300\U00000308\U00000903", {768}, {3}}, - {L"\U00000300\U00000904", {768, 2308}, {1, 2}}, - {L"\U00000300\U00000308\U00000904", {768, 2308}, {2, 3}}, - {L"\U00000300\U00000d4e", {768, 3406}, {1, 2}}, - {L"\U00000300\U00000308\U00000d4e", {768, 3406}, {2, 3}}, - {L"\U00000300\U00000915", {768, 2325}, {1, 2}}, - {L"\U00000300\U00000308\U00000915", {768, 2325}, {2, 3}}, - {L"\U00000300\U0000231a", {768, 8986}, {1, 2}}, - {L"\U00000300\U00000308\U0000231a", {768, 8986}, {2, 3}}, - {L"\U00000300\U00000300", {768}, {2}}, - {L"\U00000300\U00000308\U00000300", {768}, {3}}, - {L"\U00000300\U00000900", {768}, {2}}, - {L"\U00000300\U00000308\U00000900", {768}, {3}}, - {L"\U00000300\U0000094d", {768}, {2}}, - {L"\U00000300\U00000308\U0000094d", {768}, {3}}, - {L"\U00000300\U0000200d", {768}, {2}}, - {L"\U00000300\U00000308\U0000200d", {768}, {3}}, - {L"\U00000300\U00000378", {768, 888}, {1, 2}}, - {L"\U00000300\U00000308\U00000378", {768, 888}, {2, 3}}, - {L"\U00000900\U00000020", {2304, 32}, {1, 2}}, - {L"\U00000900\U00000308\U00000020", {2304, 32}, {2, 3}}, - {L"\U00000900\U0000000d", {2304, 13}, {1, 2}}, - {L"\U00000900\U00000308\U0000000d", {2304, 13}, {2, 3}}, - {L"\U00000900\U0000000a", {2304, 10}, {1, 2}}, - {L"\U00000900\U00000308\U0000000a", {2304, 10}, {2, 3}}, - {L"\U00000900\U00000001", {2304, 1}, {1, 2}}, - {L"\U00000900\U00000308\U00000001", {2304, 1}, {2, 3}}, - {L"\U00000900\U0000200c", {2304}, {2}}, - {L"\U00000900\U00000308\U0000200c", {2304}, {3}}, - {L"\U00000900\U0001f1e6", {2304, 127462}, {1, 2}}, - {L"\U00000900\U00000308\U0001f1e6", {2304, 127462}, {2, 3}}, - {L"\U00000900\U00000600", {2304, 1536}, {1, 2}}, - {L"\U00000900\U00000308\U00000600", {2304, 1536}, {2, 3}}, - {L"\U00000900\U00000a03", {2304}, {2}}, - {L"\U00000900\U00000308\U00000a03", {2304}, {3}}, - {L"\U00000900\U00001100", {2304, 4352}, {1, 2}}, - {L"\U00000900\U00000308\U00001100", {2304, 4352}, {2, 3}}, - {L"\U00000900\U00001160", {2304, 4448}, {1, 2}}, - {L"\U00000900\U00000308\U00001160", {2304, 4448}, {2, 3}}, - {L"\U00000900\U000011a8", {2304, 4520}, {1, 2}}, - {L"\U00000900\U00000308\U000011a8", {2304, 4520}, {2, 3}}, - {L"\U00000900\U0000ac00", {2304, 44032}, {1, 2}}, - {L"\U00000900\U00000308\U0000ac00", {2304, 44032}, {2, 3}}, - {L"\U00000900\U0000ac01", {2304, 44033}, {1, 2}}, - {L"\U00000900\U00000308\U0000ac01", {2304, 44033}, {2, 3}}, - {L"\U00000900\U00000903", {2304}, {2}}, - {L"\U00000900\U00000308\U00000903", {2304}, {3}}, - {L"\U00000900\U00000904", {2304, 2308}, {1, 2}}, - {L"\U00000900\U00000308\U00000904", {2304, 2308}, {2, 3}}, - {L"\U00000900\U00000d4e", {2304, 3406}, {1, 2}}, - {L"\U00000900\U00000308\U00000d4e", {2304, 3406}, {2, 3}}, - {L"\U00000900\U00000915", {2304, 2325}, {1, 2}}, - {L"\U00000900\U00000308\U00000915", {2304, 2325}, {2, 3}}, - {L"\U00000900\U0000231a", {2304, 8986}, {1, 2}}, - {L"\U00000900\U00000308\U0000231a", {2304, 8986}, {2, 3}}, - {L"\U00000900\U00000300", {2304}, {2}}, - {L"\U00000900\U00000308\U00000300", {2304}, {3}}, - {L"\U00000900\U00000900", {2304}, {2}}, - {L"\U00000900\U00000308\U00000900", {2304}, {3}}, - {L"\U00000900\U0000094d", {2304}, {2}}, - {L"\U00000900\U00000308\U0000094d", {2304}, {3}}, - {L"\U00000900\U0000200d", {2304}, {2}}, - {L"\U00000900\U00000308\U0000200d", {2304}, {3}}, - {L"\U00000900\U00000378", {2304, 888}, {1, 2}}, - {L"\U00000900\U00000308\U00000378", {2304, 888}, {2, 3}}, - {L"\U0000094d\U00000020", {2381, 32}, {1, 2}}, - {L"\U0000094d\U00000308\U00000020", {2381, 32}, {2, 3}}, - {L"\U0000094d\U0000000d", {2381, 13}, {1, 2}}, - {L"\U0000094d\U00000308\U0000000d", {2381, 13}, {2, 3}}, - {L"\U0000094d\U0000000a", {2381, 10}, {1, 2}}, - {L"\U0000094d\U00000308\U0000000a", {2381, 10}, {2, 3}}, - {L"\U0000094d\U00000001", {2381, 1}, {1, 2}}, - {L"\U0000094d\U00000308\U00000001", {2381, 1}, {2, 3}}, - {L"\U0000094d\U0000200c", {2381}, {2}}, - {L"\U0000094d\U00000308\U0000200c", {2381}, {3}}, - {L"\U0000094d\U0001f1e6", {2381, 127462}, {1, 2}}, - {L"\U0000094d\U00000308\U0001f1e6", {2381, 127462}, {2, 3}}, - {L"\U0000094d\U00000600", {2381, 1536}, {1, 2}}, - {L"\U0000094d\U00000308\U00000600", {2381, 1536}, {2, 3}}, - {L"\U0000094d\U00000a03", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000a03", {2381}, {3}}, - {L"\U0000094d\U00001100", {2381, 4352}, {1, 2}}, - {L"\U0000094d\U00000308\U00001100", {2381, 4352}, {2, 3}}, - {L"\U0000094d\U00001160", {2381, 4448}, {1, 2}}, - {L"\U0000094d\U00000308\U00001160", {2381, 4448}, {2, 3}}, - {L"\U0000094d\U000011a8", {2381, 4520}, {1, 2}}, - {L"\U0000094d\U00000308\U000011a8", {2381, 4520}, {2, 3}}, - {L"\U0000094d\U0000ac00", {2381, 44032}, {1, 2}}, - {L"\U0000094d\U00000308\U0000ac00", {2381, 44032}, {2, 3}}, - {L"\U0000094d\U0000ac01", {2381, 44033}, {1, 2}}, - {L"\U0000094d\U00000308\U0000ac01", {2381, 44033}, {2, 3}}, - {L"\U0000094d\U00000903", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000903", {2381}, {3}}, - {L"\U0000094d\U00000904", {2381, 2308}, {1, 2}}, - {L"\U0000094d\U00000308\U00000904", {2381, 2308}, {2, 3}}, - {L"\U0000094d\U00000d4e", {2381, 3406}, {1, 2}}, - {L"\U0000094d\U00000308\U00000d4e", {2381, 3406}, {2, 3}}, - {L"\U0000094d\U00000915", {2381, 2325}, {1, 2}}, - {L"\U0000094d\U00000308\U00000915", {2381, 2325}, {2, 3}}, - {L"\U0000094d\U0000231a", {2381, 8986}, {1, 2}}, - {L"\U0000094d\U00000308\U0000231a", {2381, 8986}, {2, 3}}, - {L"\U0000094d\U00000300", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000300", {2381}, {3}}, - {L"\U0000094d\U00000900", {2381}, {2}}, - {L"\U0000094d\U00000308\U00000900", {2381}, {3}}, - {L"\U0000094d\U0000094d", {2381}, {2}}, - {L"\U0000094d\U00000308\U0000094d", {2381}, {3}}, - {L"\U0000094d\U0000200d", {2381}, {2}}, - {L"\U0000094d\U00000308\U0000200d", {2381}, {3}}, - {L"\U0000094d\U00000378", {2381, 888}, {1, 2}}, - {L"\U0000094d\U00000308\U00000378", {2381, 888}, {2, 3}}, - {L"\U0000200d\U00000020", {8205, 32}, {1, 2}}, - {L"\U0000200d\U00000308\U00000020", {8205, 32}, {2, 3}}, - {L"\U0000200d\U0000000d", {8205, 13}, {1, 2}}, - {L"\U0000200d\U00000308\U0000000d", {8205, 13}, {2, 3}}, - {L"\U0000200d\U0000000a", {8205, 10}, {1, 2}}, - {L"\U0000200d\U00000308\U0000000a", {8205, 10}, {2, 3}}, - {L"\U0000200d\U00000001", {8205, 1}, {1, 2}}, - {L"\U0000200d\U00000308\U00000001", {8205, 1}, {2, 3}}, - {L"\U0000200d\U0000200c", {8205}, {2}}, - {L"\U0000200d\U00000308\U0000200c", {8205}, {3}}, - {L"\U0000200d\U0001f1e6", {8205, 127462}, {1, 2}}, - {L"\U0000200d\U00000308\U0001f1e6", {8205, 127462}, {2, 3}}, - {L"\U0000200d\U00000600", {8205, 1536}, {1, 2}}, - {L"\U0000200d\U00000308\U00000600", {8205, 1536}, {2, 3}}, - {L"\U0000200d\U00000a03", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000a03", {8205}, {3}}, - {L"\U0000200d\U00001100", {8205, 4352}, {1, 2}}, - {L"\U0000200d\U00000308\U00001100", {8205, 4352}, {2, 3}}, - {L"\U0000200d\U00001160", {8205, 4448}, {1, 2}}, - {L"\U0000200d\U00000308\U00001160", {8205, 4448}, {2, 3}}, - {L"\U0000200d\U000011a8", {8205, 4520}, {1, 2}}, - {L"\U0000200d\U00000308\U000011a8", {8205, 4520}, {2, 3}}, - {L"\U0000200d\U0000ac00", {8205, 44032}, {1, 2}}, - {L"\U0000200d\U00000308\U0000ac00", {8205, 44032}, {2, 3}}, - {L"\U0000200d\U0000ac01", {8205, 44033}, {1, 2}}, - {L"\U0000200d\U00000308\U0000ac01", {8205, 44033}, {2, 3}}, - {L"\U0000200d\U00000903", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000903", {8205}, {3}}, - {L"\U0000200d\U00000904", {8205, 2308}, {1, 2}}, - {L"\U0000200d\U00000308\U00000904", {8205, 2308}, {2, 3}}, - {L"\U0000200d\U00000d4e", {8205, 3406}, {1, 2}}, - {L"\U0000200d\U00000308\U00000d4e", {8205, 3406}, {2, 3}}, - {L"\U0000200d\U00000915", {8205, 2325}, {1, 2}}, - {L"\U0000200d\U00000308\U00000915", {8205, 2325}, {2, 3}}, - {L"\U0000200d\U0000231a", {8205, 8986}, {1, 2}}, - {L"\U0000200d\U00000308\U0000231a", {8205, 8986}, {2, 3}}, - {L"\U0000200d\U00000300", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000300", {8205}, {3}}, - {L"\U0000200d\U00000900", {8205}, {2}}, - {L"\U0000200d\U00000308\U00000900", {8205}, {3}}, - {L"\U0000200d\U0000094d", {8205}, {2}}, - {L"\U0000200d\U00000308\U0000094d", {8205}, {3}}, - {L"\U0000200d\U0000200d", {8205}, {2}}, - {L"\U0000200d\U00000308\U0000200d", {8205}, {3}}, - {L"\U0000200d\U00000378", {8205, 888}, {1, 2}}, - {L"\U0000200d\U00000308\U00000378", {8205, 888}, {2, 3}}, - {L"\U00000378\U00000020", {888, 32}, {1, 2}}, - {L"\U00000378\U00000308\U00000020", {888, 32}, {2, 3}}, - {L"\U00000378\U0000000d", {888, 13}, {1, 2}}, - {L"\U00000378\U00000308\U0000000d", {888, 13}, {2, 3}}, - {L"\U00000378\U0000000a", {888, 10}, {1, 2}}, - {L"\U00000378\U00000308\U0000000a", {888, 10}, {2, 3}}, - {L"\U00000378\U00000001", {888, 1}, {1, 2}}, - {L"\U00000378\U00000308\U00000001", {888, 1}, {2, 3}}, - {L"\U00000378\U0000200c", {888}, {2}}, - {L"\U00000378\U00000308\U0000200c", {888}, {3}}, - {L"\U00000378\U0001f1e6", {888, 127462}, {1, 2}}, - {L"\U00000378\U00000308\U0001f1e6", {888, 127462}, {2, 3}}, - {L"\U00000378\U00000600", {888, 1536}, {1, 2}}, - {L"\U00000378\U00000308\U00000600", {888, 1536}, {2, 3}}, - {L"\U00000378\U00000a03", {888}, {2}}, - {L"\U00000378\U00000308\U00000a03", {888}, {3}}, - {L"\U00000378\U00001100", {888, 4352}, {1, 2}}, - {L"\U00000378\U00000308\U00001100", {888, 4352}, {2, 3}}, - {L"\U00000378\U00001160", {888, 4448}, {1, 2}}, - {L"\U00000378\U00000308\U00001160", {888, 4448}, {2, 3}}, - {L"\U00000378\U000011a8", {888, 4520}, {1, 2}}, - {L"\U00000378\U00000308\U000011a8", {888, 4520}, {2, 3}}, - {L"\U00000378\U0000ac00", {888, 44032}, {1, 2}}, - {L"\U00000378\U00000308\U0000ac00", {888, 44032}, {2, 3}}, - {L"\U00000378\U0000ac01", {888, 44033}, {1, 2}}, - {L"\U00000378\U00000308\U0000ac01", {888, 44033}, {2, 3}}, - {L"\U00000378\U00000903", {888}, {2}}, - {L"\U00000378\U00000308\U00000903", {888}, {3}}, - {L"\U00000378\U00000904", {888, 2308}, {1, 2}}, - {L"\U00000378\U00000308\U00000904", {888, 2308}, {2, 3}}, - {L"\U00000378\U00000d4e", {888, 3406}, {1, 2}}, - {L"\U00000378\U00000308\U00000d4e", {888, 3406}, {2, 3}}, - {L"\U00000378\U00000915", {888, 2325}, {1, 2}}, - {L"\U00000378\U00000308\U00000915", {888, 2325}, {2, 3}}, - {L"\U00000378\U0000231a", {888, 8986}, {1, 2}}, - {L"\U00000378\U00000308\U0000231a", {888, 8986}, {2, 3}}, - {L"\U00000378\U00000300", {888}, {2}}, - {L"\U00000378\U00000308\U00000300", {888}, {3}}, - {L"\U00000378\U00000900", {888}, {2}}, - {L"\U00000378\U00000308\U00000900", {888}, {3}}, - {L"\U00000378\U0000094d", {888}, {2}}, - {L"\U00000378\U00000308\U0000094d", {888}, {3}}, - {L"\U00000378\U0000200d", {888}, {2}}, - {L"\U00000378\U00000308\U0000200d", {888}, {3}}, - {L"\U00000378\U00000378", {888, 888}, {1, 2}}, - {L"\U00000378\U00000308\U00000378", {888, 888}, {2, 3}}, - {L"\U0000000d\U0000000a\U00000061\U0000000a\U00000308", {13, 97, 10, 776}, {2, 3, 4, 5}}, - {L"\U00000061\U00000308", {97}, {2}}, - {L"\U00000020\U0000200d\U00000646", {32, 1606}, {2, 3}}, - {L"\U00000646\U0000200d\U00000020", {1606, 32}, {2, 3}}, - {L"\U00001100\U00001100", {4352}, {2}}, - {L"\U0000ac00\U000011a8\U00001100", {44032, 4352}, {2, 3}}, - {L"\U0000ac01\U000011a8\U00001100", {44033, 4352}, {2, 3}}, - {L"\U0001f1e6\U0001f1e7\U0001f1e8\U00000062", {127462, 127464, 98}, {2, 3, 4}}, - {L"\U00000061\U0001f1e6\U0001f1e7\U0001f1e8\U00000062", {97, 127462, 127464, 98}, {1, 3, 4, 5}}, - {L"\U00000061\U0001f1e6\U0001f1e7\U0000200d\U0001f1e8\U00000062", {97, 127462, 127464, 98}, {1, 4, 5, 6}}, - {L"\U00000061\U0001f1e6\U0000200d\U0001f1e7\U0001f1e8\U00000062", {97, 127462, 127463, 98}, {1, 3, 5, 6}}, - {L"\U00000061\U0001f1e6\U0001f1e7\U0001f1e8\U0001f1e9\U00000062", {97, 127462, 127464, 98}, {1, 3, 5, 6}}, - {L"\U00000061\U0000200d", {97}, {2}}, - {L"\U00000061\U00000308\U00000062", {97, 98}, {2, 3}}, - {L"\U00000061\U00000903\U00000062", {97, 98}, {2, 3}}, - {L"\U00000061\U00000600\U00000062", {97, 1536}, {1, 3}}, - {L"\U0001f476\U0001f3ff\U0001f476", {128118, 128118}, {2, 3}}, - {L"\U00000061\U0001f3ff\U0001f476", {97, 128118}, {2, 3}}, - {L"\U00000061\U0001f3ff\U0001f476\U0000200d\U0001f6d1", {97, 128118}, {2, 5}}, - {L"\U0001f476\U0001f3ff\U00000308\U0000200d\U0001f476\U0001f3ff", {128118}, {6}}, - {L"\U0001f6d1\U0000200d\U0001f6d1", {128721}, {3}}, - {L"\U00000061\U0000200d\U0001f6d1", {97, 128721}, {2, 3}}, - {L"\U00002701\U0000200d\U00002701", {9985}, {3}}, - {L"\U00000061\U0000200d\U00002701", {97, 9985}, {2, 3}}, - {L"\U00000915\U00000924", {2325, 2340}, {1, 2}}, - {L"\U00000915\U0000094d\U00000924", {2325}, {3}}, - {L"\U00000915\U0000094d\U0000094d\U00000924", {2325}, {4}}, - {L"\U00000915\U0000094d\U0000200d\U00000924", {2325}, {4}}, - {L"\U00000915\U0000093c\U0000200d\U0000094d\U00000924", {2325}, {5}}, - {L"\U00000915\U0000093c\U0000094d\U0000200d\U00000924", {2325}, {5}}, - {L"\U00000915\U0000094d\U00000924\U0000094d\U0000092f", {2325}, {5}}, - {L"\U00000915\U0000094d\U00000061", {2325, 97}, {2, 3}}, - {L"\U00000061\U0000094d\U00000924", {97, 2340}, {2, 3}}, - {L"\U0000003f\U0000094d\U00000924", {63, 2340}, {2, 3}}, - {L"\U00000915\U0000094d\U0000094d\U00000924", {2325}, {4}}}}; -#endif // TEST_HAS_NO_WIDE_CHARACTERS - -#endif // LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_EXTENDED_GRAPHEME_CLUSTER_H diff --git a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp b/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp deleted file mode 100644 index 90f7cb2..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-has-no-unicode -// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME - -// <format> - -// Tests the implementation of the extended grapheme cluster boundaries per -// https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules -// -// The tests are based on the test data provided by Unicode -// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt - -#include <cassert> -#include <format> -#include <functional> -#include <numeric> - -#include "extended_grapheme_cluster.h" - -// Validates whether the number of code points in our "database" matches with -// the number in the Unicode. The assumption is when the number of items per -// property matches the code points themselves also match. -namespace { -namespace cluster = std::__extended_grapheme_custer_property_boundary; -constexpr int count_entries(cluster::__property property) { - return std::transform_reduce( - std::begin(cluster::__entries), std::end(cluster::__entries), 0, std::plus{}, [property](auto entry) { - if (static_cast<cluster::__property>(entry & 0xf) != property) - return 0; - - return 1 + static_cast<int>((entry >> 4) & 0x7f); - }); -} - -static_assert(count_entries(cluster::__property::__Prepend) == 28); -static_assert(count_entries(cluster::__property::__CR) == 1); -static_assert(count_entries(cluster::__property::__LF) == 1); -static_assert(count_entries(cluster::__property::__Control) == 3893); -static_assert(count_entries(cluster::__property::__Extend) == 2198); -static_assert(count_entries(cluster::__property::__Regional_Indicator) == 26); -static_assert(count_entries(cluster::__property::__SpacingMark) == 378); -static_assert(count_entries(cluster::__property::__L) == 125); -static_assert(count_entries(cluster::__property::__V) == 100); -static_assert(count_entries(cluster::__property::__T) == 137); -static_assert(count_entries(cluster::__property::__LV) == 399); -static_assert(count_entries(cluster::__property::__LVT) == 10773); -static_assert(count_entries(cluster::__property::__ZWJ) == 1); -static_assert(count_entries(cluster::__property::__Extended_Pictographic) == 3537); - -namespace inCB = std::__indic_conjunct_break; -constexpr int count_entries(inCB::__property property) { - return std::transform_reduce( - std::begin(inCB::__entries), std::end(inCB::__entries), 0, std::plus{}, [property](auto entry) { - if (static_cast<inCB::__property>(entry & 0b11) != property) - return 0; - - return 1 + static_cast<int>((entry >> 2) & 0b1'1111'1111); - }); -} - -static_assert(count_entries(inCB::__property::__Linker) == 6); -static_assert(count_entries(inCB::__property::__Consonant) == 240); -static_assert(count_entries(inCB::__property::__Extend) == 2192); - -} // namespace - -template <class Data> -constexpr void test(const Data& data) { - for (const auto& d : data) { - assert(d.code_points.size() == d.breaks.size()); - - std::__unicode::__extended_grapheme_cluster_view view{d.input.begin(), d.input.end()}; - for (std::size_t i = 0; i < d.breaks.size(); ++i) { - auto r = view.__consume(); - assert(r.__code_point_ == d.code_points[i]); - assert(r.__last_ == d.input.begin() + d.breaks[i]); - } - } -} - -constexpr bool test() { - test(data_utf8); - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - if constexpr (sizeof(wchar_t) == 2) - test(data_utf16); - else - test(data_utf32); -#endif - - return true; -} - -int main(int, char**) { - test(); - // static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/test_exception.h b/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/test_exception.h deleted file mode 100644 index 3b87942..0000000 --- a/libcxx/test/libcxx-03/utilities/format/format.string/format.string.std/test_exception.h +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_TEST_EXCEPTION_H -#define _LIBCPP_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_TEST_EXCEPTION_H - -#include <format> -#include <string_view> - -namespace detail { -#ifndef TEST_HAS_NO_EXCEPTIONS -template <class Parser, class CharT> -void test_exception(std::string_view what, const CharT* fmt) { - try { - std::basic_format_parse_context<CharT> parse_ctx(fmt); - (void)Parser{}.parse(parse_ctx); - assert(false); - } catch (std::format_error& e) { - LIBCPP_ASSERT(e.what() == what); - return; - } - - assert(false); -} -#endif -} // namespace detail - -/** - * Wrapper for the exception tests. - * - * When using the real function directly during in a constexpr test and add - * the `std::is_constant_evaluated()` test there the compilation fails. This - * happens since assert calls the non-constexpr function '__assert_fail'. - * Solve this issue with an layer of indirection. - */ -template <class Parser, class CharT> -constexpr void test_exception(std::string_view what, const CharT* fmt) { -#ifndef TEST_HAS_NO_EXCEPTIONS - if (!std::is_constant_evaluated()) - detail::test_exception<Parser>(what, fmt); -#else - (void)what; - (void)fmt; -#endif -} - -#endif // _LIBCPP_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_TEST_EXCEPTION_H diff --git a/libcxx/test/libcxx-03/utilities/format/no_specializations.verify.cpp b/libcxx/test/libcxx-03/utilities/format/no_specializations.verify.cpp deleted file mode 100644 index e1acbaf..0000000 --- a/libcxx/test/libcxx-03/utilities/format/no_specializations.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Check that user-specializations are diagnosed -// See [format.arg]/2 - -#include <format> - -#if !__has_warning("-Winvalid-specialization") -// expected-no-diagnostics -#else -struct S {}; - -template <> -class std::basic_format_arg<S>; // expected-error {{cannot be specialized}} -#endif diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.bind.partial/bind_back.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.bind.partial/bind_back.pass.cpp deleted file mode 100644 index de7d78f..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.bind.partial/bind_back.pass.cpp +++ /dev/null @@ -1,416 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// functional - -// template <class F, class... Args> -// constexpr unspecified __bind_back(F&&, Args&&...); - -// This isn't part of the standard, however we use it internally and there is a -// chance that it will be added to the standard, so we implement those tests -// as-if it were part of the spec. - -#include <functional> -#include <cassert> -#include <tuple> -#include <utility> - -#include "callable_types.h" -#include "test_macros.h" - -struct CopyMoveInfo { - enum { none, copy, move } copy_kind; - - constexpr CopyMoveInfo() : copy_kind(none) {} - constexpr CopyMoveInfo(CopyMoveInfo const&) : copy_kind(copy) {} - constexpr CopyMoveInfo(CopyMoveInfo&&) : copy_kind(move) {} -}; - -template <class ...Args> -struct is_bind_backable { - template <class ...LocalArgs> - static auto test(int) - -> decltype((void)std::__bind_back(std::declval<LocalArgs>()...), std::true_type()); - - template <class...> - static std::false_type test(...); - - static constexpr bool value = decltype(test<Args...>(0))::value; -}; - -struct NotCopyMove { - NotCopyMove() = delete; - NotCopyMove(const NotCopyMove&) = delete; - NotCopyMove(NotCopyMove&&) = delete; - template <class ...Args> - void operator()(Args&& ...) const { } -}; - -struct NonConstCopyConstructible { - explicit NonConstCopyConstructible() {} - NonConstCopyConstructible(NonConstCopyConstructible&) {} -}; - -struct MoveConstructible { - explicit MoveConstructible() {} - MoveConstructible(MoveConstructible&&) {} -}; - -struct MakeTuple { - template <class ...Args> - constexpr auto operator()(Args&& ...args) const { - return std::make_tuple(std::forward<Args>(args)...); - } -}; - -template <int X> -struct Elem { - template <int Y> - constexpr bool operator==(Elem<Y> const&) const - { return X == Y; } -}; - -constexpr bool test() { - // Bind arguments, call without arguments - { - { - auto f = std::__bind_back(MakeTuple{}); - assert(f() == std::make_tuple()); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}); - assert(f() == std::make_tuple(Elem<1>{})); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}, Elem<2>{}); - assert(f() == std::make_tuple(Elem<1>{}, Elem<2>{})); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}, Elem<2>{}, Elem<3>{}); - assert(f() == std::make_tuple(Elem<1>{}, Elem<2>{}, Elem<3>{})); - } - } - - // Bind no arguments, call with arguments - { - { - auto f = std::__bind_back(MakeTuple{}); - assert(f(Elem<1>{}) == std::make_tuple(Elem<1>{})); - } - { - auto f = std::__bind_back(MakeTuple{}); - assert(f(Elem<1>{}, Elem<2>{}) == std::make_tuple(Elem<1>{}, Elem<2>{})); - } - { - auto f = std::__bind_back(MakeTuple{}); - assert(f(Elem<1>{}, Elem<2>{}, Elem<3>{}) == std::make_tuple(Elem<1>{}, Elem<2>{}, Elem<3>{})); - } - } - - // Bind arguments, call with arguments - { - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}); - assert(f(Elem<10>{}) == std::make_tuple(Elem<10>{}, Elem<1>{})); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}, Elem<2>{}); - assert(f(Elem<10>{}) == std::make_tuple(Elem<10>{}, Elem<1>{}, Elem<2>{})); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}, Elem<2>{}, Elem<3>{}); - assert(f(Elem<10>{}) == std::make_tuple(Elem<10>{}, Elem<1>{}, Elem<2>{}, Elem<3>{})); - } - - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}); - assert(f(Elem<10>{}, Elem<11>{}) == std::make_tuple(Elem<10>{}, Elem<11>{}, Elem<1>{})); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}, Elem<2>{}); - assert(f(Elem<10>{}, Elem<11>{}) == std::make_tuple(Elem<10>{}, Elem<11>{}, Elem<1>{}, Elem<2>{})); - } - { - auto f = std::__bind_back(MakeTuple{}, Elem<1>{}, Elem<2>{}, Elem<3>{}); - assert(f(Elem<10>{}, Elem<11>{}) == std::make_tuple(Elem<10>{}, Elem<11>{}, Elem<1>{}, Elem<2>{}, Elem<3>{})); - } - } - - // Basic tests with fundamental types - { - int n = 2; - int m = 1; - auto add = [](int x, int y) { return x + y; }; - auto addN = [](int a, int b, int c, int d, int e, int f) { - return a + b + c + d + e + f; - }; - - auto a = std::__bind_back(add, m, n); - assert(a() == 3); - - auto b = std::__bind_back(addN, m, n, m, m, m, m); - assert(b() == 7); - - auto c = std::__bind_back(addN, n, m); - assert(c(1, 1, 1, 1) == 7); - - auto f = std::__bind_back(add, n); - assert(f(3) == 5); - - auto g = std::__bind_back(add, n, 1); - assert(g() == 3); - - auto h = std::__bind_back(addN, 1, 1, 1); - assert(h(2, 2, 2) == 9); - } - - // Make sure we don't treat std::reference_wrapper specially. - { - auto sub = [](std::reference_wrapper<int> a, std::reference_wrapper<int> b) { - return a.get() - b.get(); - }; - int i = 1, j = 2; - auto f = std::__bind_back(sub, std::ref(i)); - assert(f(std::ref(j)) == 2 - 1); - } - - // Make sure we can call a function that's a pointer to a member function. - { - struct MemberFunction { - constexpr bool foo(int, int) { return true; } - }; - MemberFunction value; - auto fn = std::__bind_back(&MemberFunction::foo, 0, 0); - assert(fn(value)); - } - - // Make sure that we copy the bound arguments into the unspecified-type. - { - auto add = [](int x, int y) { return x + y; }; - int n = 2; - auto i = std::__bind_back(add, n, 1); - n = 100; - assert(i() == 3); - } - - // Make sure we pass the bound arguments to the function object - // with the right value category. - { - { - auto wasCopied = [](CopyMoveInfo info) { - return info.copy_kind == CopyMoveInfo::copy; - }; - CopyMoveInfo info; - auto copied = std::__bind_back(wasCopied, info); - assert(copied()); - } - - { - auto wasMoved = [](CopyMoveInfo info) { - return info.copy_kind == CopyMoveInfo::move; - }; - CopyMoveInfo info; - auto moved = std::__bind_back(wasMoved, info); - assert(std::move(moved)()); - } - } - - // Make sure we call the correctly cv-ref qualified operator() based on the - // value category of the __bind_back unspecified-type. - { - struct F { - constexpr int operator()() & { return 1; } - constexpr int operator()() const& { return 2; } - constexpr int operator()() && { return 3; } - constexpr int operator()() const&& { return 4; } - }; - auto x = std::__bind_back(F{}); - using X = decltype(x); - assert(static_cast<X&>(x)() == 1); - assert(static_cast<X const&>(x)() == 2); - assert(static_cast<X&&>(x)() == 3); - assert(static_cast<X const&&>(x)() == 4); - } - - // Make sure the __bind_back unspecified-type is NOT invocable when the call would select a - // differently-qualified operator(). - // - // For example, if the call to `operator()() &` is ill-formed, the call to the unspecified-type - // should be ill-formed and not fall back to the `operator()() const&` overload. - { - // Make sure we delete the & overload when the underlying call isn't valid - { - struct F { - void operator()() & = delete; - void operator()() const&; - void operator()() &&; - void operator()() const&&; - }; - using X = decltype(std::__bind_back(F{})); - static_assert(!std::is_invocable_v<X&>); - static_assert( std::is_invocable_v<X const&>); - static_assert( std::is_invocable_v<X>); - static_assert( std::is_invocable_v<X const>); - } - - // There's no way to make sure we delete the const& overload when the underlying call isn't valid, - // so we can't check this one. - - // Make sure we delete the && overload when the underlying call isn't valid - { - struct F { - void operator()() &; - void operator()() const&; - void operator()() && = delete; - void operator()() const&&; - }; - using X = decltype(std::__bind_back(F{})); - static_assert( std::is_invocable_v<X&>); - static_assert( std::is_invocable_v<X const&>); - static_assert(!std::is_invocable_v<X>); - static_assert( std::is_invocable_v<X const>); - } - - // Make sure we delete the const&& overload when the underlying call isn't valid - { - struct F { - void operator()() &; - void operator()() const&; - void operator()() &&; - void operator()() const&& = delete; - }; - using X = decltype(std::__bind_back(F{})); - static_assert( std::is_invocable_v<X&>); - static_assert( std::is_invocable_v<X const&>); - static_assert( std::is_invocable_v<X>); - static_assert(!std::is_invocable_v<X const>); - } - } - - // Some examples by Tim Song - { - { - struct T { }; - struct F { - void operator()(T&&) const &; - void operator()(T&&) && = delete; - }; - using X = decltype(std::__bind_back(F{})); - static_assert(!std::is_invocable_v<X, T>); - } - - { - struct T { }; - struct F { - void operator()(T const&) const; - void operator()(T&&) const = delete; - }; - using X = decltype(std::__bind_back(F{}, T{})); - static_assert(!std::is_invocable_v<X>); - } - } - - // Test properties of the constructor of the unspecified-type returned by __bind_back. - { - { - MoveOnlyCallable<bool> value(true); - auto ret = std::__bind_back(std::move(value), 1); - assert(ret()); - assert(ret(1, 2, 3)); - - auto ret1 = std::move(ret); - assert(!ret()); - assert(ret1()); - assert(ret1(1, 2, 3)); - - using RetT = decltype(ret); - static_assert( std::is_move_constructible<RetT>::value); - static_assert(!std::is_copy_constructible<RetT>::value); - static_assert(!std::is_move_assignable<RetT>::value); - static_assert(!std::is_copy_assignable<RetT>::value); - } - { - CopyCallable<bool> value(true); - auto ret = std::__bind_back(value, 1); - assert(ret()); - assert(ret(1, 2, 3)); - - auto ret1 = std::move(ret); - assert(ret1()); - assert(ret1(1, 2, 3)); - - auto ret2 = std::__bind_back(std::move(value), 1); - assert(!ret()); - assert(ret2()); - assert(ret2(1, 2, 3)); - - using RetT = decltype(ret); - static_assert( std::is_move_constructible<RetT>::value); - static_assert( std::is_copy_constructible<RetT>::value); - static_assert(!std::is_move_assignable<RetT>::value); - static_assert(!std::is_copy_assignable<RetT>::value); - } - { - CopyAssignableWrapper value(true); - using RetT = decltype(std::__bind_back(value, 1)); - - static_assert(std::is_move_constructible<RetT>::value); - static_assert(std::is_copy_constructible<RetT>::value); - static_assert(std::is_move_assignable<RetT>::value); - static_assert(std::is_copy_assignable<RetT>::value); - } - { - MoveAssignableWrapper value(true); - using RetT = decltype(std::__bind_back(std::move(value), 1)); - - static_assert( std::is_move_constructible<RetT>::value); - static_assert(!std::is_copy_constructible<RetT>::value); - static_assert( std::is_move_assignable<RetT>::value); - static_assert(!std::is_copy_assignable<RetT>::value); - } - } - - // Make sure __bind_back is SFINAE friendly - { - static_assert(!std::is_constructible_v<NotCopyMove, NotCopyMove&>); - static_assert(!std::is_move_constructible_v<NotCopyMove>); - static_assert(!is_bind_backable<NotCopyMove>::value); - static_assert(!is_bind_backable<NotCopyMove&>::value); - - auto takeAnything = [](auto&& ...) { }; - static_assert(!std::is_constructible_v<MoveConstructible, MoveConstructible&>); - static_assert( std::is_move_constructible_v<MoveConstructible>); - static_assert( is_bind_backable<decltype(takeAnything), MoveConstructible>::value); - static_assert(!is_bind_backable<decltype(takeAnything), MoveConstructible&>::value); - - static_assert( std::is_constructible_v<NonConstCopyConstructible, NonConstCopyConstructible&>); - static_assert(!std::is_move_constructible_v<NonConstCopyConstructible>); - static_assert(!is_bind_backable<decltype(takeAnything), NonConstCopyConstructible&>::value); - static_assert(!is_bind_backable<decltype(takeAnything), NonConstCopyConstructible>::value); - } - - // Make sure bind_back's unspecified type's operator() is SFINAE-friendly - { - using T = decltype(std::__bind_back(std::declval<int(*)(int, int)>(), 1)); - static_assert(!std::is_invocable<T>::value); - static_assert( std::is_invocable<T, int>::value); - static_assert(!std::is_invocable<T, void*>::value); - static_assert(!std::is_invocable<T, int, int>::value); - } - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.bind.partial/compose.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.bind.partial/compose.pass.cpp deleted file mode 100644 index 7e59708..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.bind.partial/compose.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template <class F1, class F2> -// constexpr unspecified __compose(F1&&, F2&&); - -#include <__functional/compose.h> -#include <cassert> -#include <tuple> -#include <utility> - -template <int X> -struct Elem { - template <int Y> - constexpr bool operator==(Elem<Y> const&) const - { return X == Y; } -}; - -struct F { - template <class ...Args> - constexpr auto operator()(Args&& ...args) const { - return std::make_tuple(Elem<888>{}, std::forward<Args>(args)...); - } -}; - -struct G { - template <class ...Args> - constexpr auto operator()(Args&& ...args) const { - return std::make_tuple(Elem<999>{}, std::forward<Args>(args)...); - } -}; - -constexpr bool test() { - F const f; - G const g; - - { - auto c = std::__compose(f, g); - assert(c() == f(g())); - } - { - auto c = std::__compose(f, g); - assert(c(Elem<0>{}) == f(g(Elem<0>{}))); - } - { - auto c = std::__compose(f, g); - assert(c(Elem<0>{}, Elem<1>{}) == f(g(Elem<0>{}, Elem<1>{}))); - } - { - auto c = std::__compose(f, g); - assert(c(Elem<0>{}, Elem<1>{}, Elem<2>{}) == f(g(Elem<0>{}, Elem<1>{}, Elem<2>{}))); - } - - // Make sure we can call a function that's a pointer to a member function. - { - struct MemberFunction1 { - constexpr Elem<0> foo() { return {}; } - }; - struct MemberFunction2 { - constexpr MemberFunction1 bar() { return {}; } - }; - auto c = std::__compose(&MemberFunction1::foo, &MemberFunction2::bar); - assert(c(MemberFunction2{}) == Elem<0>{}); - } - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.blocks.arc.pass.mm b/libcxx/test/libcxx-03/utilities/function.objects/func.blocks.arc.pass.mm deleted file mode 100644 index c9ace62..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.blocks.arc.pass.mm +++ /dev/null @@ -1,89 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// std::function support for "blocks" when ARC is enabled - -// UNSUPPORTED: c++03 - -// This test requires the Blocks runtime, which is (only?) available on Darwin -// out-of-the-box. -// REQUIRES: has-fblocks && has-fobjc-arc && darwin - -// ADDITIONAL_COMPILE_FLAGS: -fblocks -fobjc-arc - -#include <functional> - -#include <cassert> -#include <cstddef> -#include <string> - -struct Foo { - Foo() = default; - Foo(std::size_t (^bl)()) : f(bl) {} - - std::function<int()> f; -}; - -Foo Factory(std::size_t (^bl)()) { - Foo result(bl); - return result; -} - -Foo Factory2() { - auto hello = std::string("Hello world"); - return Factory(^() { - return hello.size(); - }); -} - -Foo AssignmentFactory(std::size_t (^bl)()) { - Foo result; - result.f = bl; - return result; -} - -Foo AssignmentFactory2() { - auto hello = std::string("Hello world"); - return AssignmentFactory(^() { - return hello.size(); - }); -} - -int main(int, char **) { - // Case 1, works - { - auto hello = std::string("Hello world"); - auto f = AssignmentFactory(^() { - return hello.size(); - }); - assert(f.f() == 11); - } - - // Case 2, works - { - auto f = AssignmentFactory2(); - assert(f.f() == 11); - } - - // Case 3, works - { - auto hello = std::string("Hello world"); - auto f = Factory(^() { - return hello.size(); - }); - assert(f.f() == 11); - } - - // Case 4, used to crash under ARC - { - auto f = Factory2(); - assert(f.f() == 11); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.blocks.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.blocks.pass.cpp deleted file mode 100644 index a917e9f..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.blocks.pass.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// std::function support for the "blocks" extension - -// UNSUPPORTED: c++03 - -// This test requires the Blocks runtime, which is (only?) available -// on Darwin out-of-the-box. -// REQUIRES: has-fblocks && darwin - -// ADDITIONAL_COMPILE_FLAGS: -fblocks - -#include <cassert> -#include <cstdlib> -#include <functional> -#include <typeinfo> - -#include <Block.h> - -#include "test_macros.h" -#include "count_new.h" - - -struct A { - static int count; - int id_; - explicit A(int id) { ++count; id_ = id; } - A(const A &a) { id_ = a.id_; ++count; } - ~A() { id_ = -1; --count; } - int operator()() const { return -1; } - int operator()(int i) const { return i; } - int operator()(int, int) const { return -2; } - int operator()(int, int, int) const { return -3; } - int id() const { return id_; } -}; - -int A::count = 0; - -int g(int) { return 0; } - -int main(int, char**) -{ - // swap - { - std::function<int(int)> f1 = g; - std::function<int(int)> f2 = ^(int x) { return x + 1; }; - assert(globalMemCounter.checkOutstandingNewEq(0)); - RTTI_ASSERT(*f1.target<int(*)(int)>() == g); - RTTI_ASSERT(*f2.target<int(^)(int)>() != 0); - swap(f1, f2); - assert(globalMemCounter.checkOutstandingNewEq(0)); - RTTI_ASSERT(*f1.target<int(^)(int)>() != 0); - RTTI_ASSERT(*f2.target<int(*)(int)>() == g); - } - - // operator bool - { - std::function<int(int)> f; - assert(!f); - f = ^(int x) { return x+1; }; - assert(f); - } - - // operator() - { - std::function<int ()> r1(^{ return 4; }); - assert(r1() == 4); - } - { - __block bool called = false; - std::function<void ()> r1(^{ called = true; }); - r1(); - assert(called); - } - { - __block int param = 0; - std::function<void (int)> r1(^(int x){ param = x; }); - r1(4); - assert(param == 4); - } - { - std::function<int (int)> r1(^(int x){ return x + 4; }); - assert(r1(3) == 7); - } - { - __block int param1 = 0; - __block int param2 = 0; - std::function<void (int, int)> r1(^(int x, int y){ param1 = x; param2 = y; }); - r1(3, 4); - assert(param1 == 3); - assert(param2 == 4); - } - { - std::function<int (int, int)> r1(^(int x, int y){ return x + y; }); - assert(r1(3, 4) == 7); - } - - // swap - { - std::function<int(int)> f1 = A(999); - std::function<int(int)> f2 = ^(int x) { return x + 1; }; - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - RTTI_ASSERT(f1.target<A>()->id() == 999); - RTTI_ASSERT((*f2.target<int(^)(int)>())(13) == 14); - f1.swap(f2); - assert(A::count == 1); - assert(globalMemCounter.checkOutstandingNewEq(1)); - RTTI_ASSERT((*f1.target<int(^)(int)>())(13) == 14); - RTTI_ASSERT(f2.target<A>()->id() == 999); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - assert(A::count == 0); - - // operator== and operator!= - { - std::function<int(int)> f; - assert(f == nullptr); - assert(nullptr == f); - f = ^(int x) { return x + 1; }; - assert(f != nullptr); - assert(nullptr != f); - } - - // target - { - int (^block)(int) = Block_copy(^(int x) { return x + 1; }); - std::function<int(int)> f = block; - RTTI_ASSERT(*f.target<int(^)(int)>() == block); - RTTI_ASSERT(f.target<int(*)(int)>() == 0); - Block_release(block); - } - - // target_type - { - std::function<int(int)> f = ^(int x) { return x + 1; }; - RTTI_ASSERT(f.target_type() == typeid(int(^)(int))); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.not.fn/not_fn.nttp.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.not.fn/not_fn.nttp.compile.pass.cpp deleted file mode 100644 index b0128ae..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.not.fn/not_fn.nttp.compile.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 - -// <functional> - -// Type of `std::not_fn<NTTP>()` is always empty. - -#include <functional> -#include <type_traits> - -struct NonEmptyFunctionObject { - bool val = true; - bool operator()() const; -}; - -bool func(); - -struct SomeClass { - bool member_object; - bool member_function(); -}; - -using ResultWithEmptyFuncObject = decltype(std::not_fn<std::false_type{}>()); -static_assert(std::is_empty_v<ResultWithEmptyFuncObject>); - -using ResultWithNotEmptyFuncObject = decltype(std::not_fn<NonEmptyFunctionObject{}>()); -static_assert(std::is_empty_v<ResultWithNotEmptyFuncObject>); - -using ResultWithFunctionPointer = decltype(std::not_fn<&func>()); -static_assert(std::is_empty_v<ResultWithFunctionPointer>); - -using ResultWithMemberObjectPointer = decltype(std::not_fn<&SomeClass::member_object>()); -static_assert(std::is_empty_v<ResultWithMemberObjectPointer>); - -using ResultWithMemberFunctionPointer = decltype(std::not_fn<&SomeClass::member_function>()); -static_assert(std::is_empty_v<ResultWithMemberFunctionPointer>); diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.not.fn/not_fn.nttp.nodiscard.verify.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.not.fn/not_fn.nttp.nodiscard.verify.cpp deleted file mode 100644 index acef2d3..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.not.fn/not_fn.nttp.nodiscard.verify.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 - -// <functional> - -// Test the libc++ extension that std::not_fn<NTTP> is marked as [[nodiscard]]. - -#include <functional> -#include <type_traits> - -void test() { - using F = std::true_type; - std::not_fn<F{}>(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} - - auto negated = std::not_fn<F{}>(); - negated(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp deleted file mode 100644 index acf224e..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <functional> - -// class function<R(ArgTypes...)> - -// function& operator=(function &&); - -#include <functional> -#include <cassert> - -#include "test_macros.h" - -struct A -{ - static std::function<void()> global; - static bool cancel; - - A() = default; - A(const A&) = default; - A& operator=(const A&) = default; - ~A() { - DoNotOptimize(cancel); - if (cancel) - global = std::function<void()>(nullptr); - } - void operator()() {} -}; - -std::function<void()> A::global; -bool A::cancel = false; - -int main(int, char**) -{ - A::global = A(); - RTTI_ASSERT(A::global.target<A>()); - - // Check that we don't recurse in A::~A(). - A::cancel = true; - A::global = std::function<void()>(nullptr); - RTTI_ASSERT(!A::global.target<A>()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp deleted file mode 100644 index 83c342b..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <functional> - -// class function<R(ArgTypes...)> - -// function& operator=(nullptr_t); - -#include <functional> -#include <cassert> - -#include "test_macros.h" - -struct A -{ - static std::function<void()> global; - static bool cancel; - - A() = default; - A(const A&) = default; - A& operator=(const A&) = default; - ~A() { - DoNotOptimize(cancel); - if (cancel) - global = nullptr; - } - void operator()() {} -}; - -std::function<void()> A::global; -bool A::cancel = false; - -int main(int, char**) -{ - A::global = A(); - RTTI_ASSERT(A::global.target<A>()); - - // Check that we don't recurse in A::~A(). - A::cancel = true; - A::global = nullptr; - RTTI_ASSERT(!A::global.target<A>()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.unary.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.unary.compile.pass.cpp deleted file mode 100644 index 58b8dc5..0000000 --- a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.unary.compile.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 -// UNSUPPORTED: msvc - -// ensure that unary_function always has the same ABI - -#include <functional> - -struct S1 : std::negate<int>, std::bit_not<int> {}; - -static_assert(sizeof(S1) == 2, ""); - -struct S2 : std::negate<int> { char c; }; - -static_assert(sizeof(S2) == 1, ""); diff --git a/libcxx/test/libcxx-03/utilities/intseq/for_each_index_sequence.pass.cpp b/libcxx/test/libcxx-03/utilities/intseq/for_each_index_sequence.pass.cpp deleted file mode 100644 index 9934527..0000000 --- a/libcxx/test/libcxx-03/utilities/intseq/for_each_index_sequence.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <utility> - -// inline constexpr auto __for_each_index_sequence = []<size_t... _Index>(index_sequence<_Index...>, auto __func) - -#include <utility> -#include <cassert> - -#include "test_macros.h" - -constexpr bool test() { - int count = 0; - std::__for_each_index_sequence(std::make_index_sequence<8>(), [&]<std::size_t _Index> { count += _Index; }); - assert(count == 28); - - return true; -} - -int main(int, char**) { - test(); - static_assert(test()); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/memory/ptr.align/assume_aligned.const_eval.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/ptr.align/assume_aligned.const_eval.verify.cpp deleted file mode 100644 index d63018d..0000000 --- a/libcxx/test/libcxx-03/utilities/memory/ptr.align/assume_aligned.const_eval.verify.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// template<size_t N, class T> -// [[nodiscard]] constexpr T* assume_aligned(T* ptr); - -#include <memory> -#include <cstddef> - -template <size_t Size> -constexpr bool test() { - char data[1]; - - [[maybe_unused]] auto data1 = std::assume_aligned<Size>(data); - - return true; -} - -static_assert(test<2>()); -// expected-error@-1 {{static assertion expression is not an integral constant expression}} -// expected-note@* {{alignment of the base pointee object (1 byte) is less than the asserted 2 bytes}} - -static_assert(test<4>()); -// expected-error@-1 {{static assertion expression is not an integral constant expression}} -// expected-note@* {{alignment of the base pointee object (1 byte) is less than the asserted 4 bytes}} - -static_assert(test<8>()); -// expected-error@-1 {{static assertion expression is not an integral constant expression}} -// expected-note@* {{alignment of the base pointee object (1 byte) is less than the asserted 8 bytes}} - -static_assert(test<16>()); -// expected-error@-1 {{static assertion expression is not an integral constant expression}} -// expected-note@* {{alignment of the base pointee object (1 byte) is less than the asserted 16 bytes}} - -static_assert(test<32>()); -// expected-error@-1 {{static assertion expression is not an integral constant expression}} -// expected-note@* {{alignment of the base pointee object (1 byte) is less than the asserted 32 bytes}} - -static_assert(test<64>()); -// expected-error@-1 {{static assertion expression is not an integral constant expression}} -// expected-note@* {{alignment of the base pointee object (1 byte) is less than the asserted 64 bytes}} diff --git a/libcxx/test/libcxx-03/utilities/memory/ptr.align/assume_aligned.power2.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/ptr.align/assume_aligned.power2.verify.cpp deleted file mode 100644 index b206fe3..0000000 --- a/libcxx/test/libcxx-03/utilities/memory/ptr.align/assume_aligned.power2.verify.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// #include <memory> - -// template<size_t N, class T> -// [[nodiscard]] constexpr T* assume_aligned(T* ptr); - -// This test checks that we static_assert inside std::assume_aligned<N>(p) -// when N is not a power of two. However, Clang will already emit an error -// in its own __builtin_assume_aligned, so we ignore that additional error -// for the purpose of this test. We also ignore the additional warning about -// remainder by 0 being undefined. -// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error -Xclang -verify-ignore-unexpected=warning - -#include <memory> - -void f() { - int *p = nullptr; - (void)std::assume_aligned<0>(p); // expected-error@*:* {{std::assume_aligned<N>(p) requires N to be a power of two}} - (void)std::assume_aligned<3>(p); // expected-error@*:* {{std::assume_aligned<N>(p) requires N to be a power of two}} - (void)std::assume_aligned<5>(p); // expected-error@*:* {{std::assume_aligned<N>(p) requires N to be a power of two}} - (void)std::assume_aligned<33>(p); // expected-error@*:* {{std::assume_aligned<N>(p) requires N to be a power of two}} -} diff --git a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.verify.cpp deleted file mode 100644 index 26ecfe6..0000000 --- a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.verify.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -#include <memory> -#include <cstddef> -#include <type_traits> - -template <int> struct Tag {}; - -template <int ID> -using SPtr = std::shared_ptr<void(Tag<ID>)>; - -template <int ID> -using FnType = void(Tag<ID>); - -template <int ID> -void TestFn(Tag<ID>) {} - -template <int ID> -FnType<ID>* getFn() { - return &TestFn<ID>; -} - -struct Deleter { - template <class Tp> - void operator()(Tp) const { - using RawT = typename std::remove_pointer<Tp>::type; - static_assert(std::is_function<RawT>::value || - std::is_same<typename std::remove_cv<RawT>::type, - std::nullptr_t>::value, - ""); - } -}; - -int main(int, char**) { - { - SPtr<0> s; // OK - SPtr<1> s1(nullptr); // OK - SPtr<2> s2(getFn<2>(), Deleter{}); // OK - SPtr<3> s3(nullptr, Deleter{}); // OK - } - - // expected-error-re@*:* {{static assertion failed{{.*}}default_delete cannot be instantiated for function types}} - std::default_delete<FnType<5>> deleter{}; // expected-note {{requested here}} - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/libcxx.control_block_layout.pass.cpp b/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/libcxx.control_block_layout.pass.cpp deleted file mode 100644 index 0b48bc9..0000000 --- a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/libcxx.control_block_layout.pass.cpp +++ /dev/null @@ -1,232 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcpp-abi-no-compressed-pair-padding - -// This test makes sure that the control block implementation used for non-array -// types in std::make_shared and std::allocate_shared is ABI compatible with the -// original implementation. -// -// This test is relevant because the implementation of that control block is -// different starting in C++20, a change that was required to implement P0674. - -#include <cassert> -#include <cstddef> -#include <memory> -#include <tuple> -#include <type_traits> -#include <utility> - -#include <string> -#include <vector> - -#include "test_macros.h" - -struct value_init_tag {}; - -template <class T, int _Idx, bool CanBeEmptyBase = std::is_empty<T>::value && !std::__libcpp_is_final<T>::value> -struct compressed_pair_elem { - explicit compressed_pair_elem(value_init_tag) : value_() {} - - template <class U> - explicit compressed_pair_elem(U&& u) : value_(std::forward<U>(u)) {} - - T& get() { return value_; } - -private: - T value_; -}; - -template <class T, int _Idx> -struct compressed_pair_elem<T, _Idx, true> : private T { - explicit compressed_pair_elem(value_init_tag) : T() {} - - template <class U> - explicit compressed_pair_elem(U&& u) : T(std::forward<U>(u)) {} - - T& get() { return *this; } -}; - -template <class T1, class T2> -class compressed_pair : private compressed_pair_elem<T1, 0>, private compressed_pair_elem<T2, 1> { -public: - using Base1 = compressed_pair_elem<T1, 0>; - using Base2 = compressed_pair_elem<T2, 1>; - - template <class U1, class U2> - explicit compressed_pair(U1&& t1, U2&& t2) : Base1(std::forward<U1>(t1)), Base2(std::forward<U2>(t2)) {} - - T1& first() { return static_cast<Base1&>(*this).get(); } - T2& second() { return static_cast<Base2&>(*this).get(); } -}; - -// This is the pre-C++20 implementation of the control block used by non-array -// std::allocate_shared and std::make_shared. We keep it here so that we can -// make sure our implementation is backwards compatible with it forever. -// -// Of course, the class and its methods were renamed, but the size and layout -// of the class should remain the same as the original implementation. -template <class T, class Alloc> -struct OldEmplaceControlBlock : std::__shared_weak_count { - explicit OldEmplaceControlBlock(Alloc a) : data_(std::move(a), value_init_tag()) {} - T* get_elem() noexcept { return std::addressof(data_.second()); } - Alloc* get_alloc() noexcept { return std::addressof(data_.first()); } - -private: - virtual void __on_zero_shared() noexcept { - // Not implemented - } - - virtual void __on_zero_shared_weak() noexcept { - // Not implemented - } - - compressed_pair<Alloc, T> data_; -}; - -template <class T, template <class> class Alloc> -void test() { - using Old = OldEmplaceControlBlock<T, Alloc<T>>; - using New = std::__shared_ptr_emplace<T, Alloc<T>>; - - static_assert(sizeof(New) == sizeof(Old), ""); - static_assert(alignof(New) == alignof(Old), ""); - - // Also make sure each member is at the same offset - Alloc<T> a; - Old old(a); - New new_(a); - - // 1. Check the stored object - { - char const* old_elem = reinterpret_cast<char const*>(old.get_elem()); - char const* new_elem = reinterpret_cast<char const*>(new_.__get_elem()); - std::ptrdiff_t old_offset = old_elem - reinterpret_cast<char const*>(&old); - std::ptrdiff_t new_offset = new_elem - reinterpret_cast<char const*>(&new_); - assert(new_offset == old_offset && "offset of stored element changed"); - } - - // 2. Check the allocator - { - char const* old_alloc = reinterpret_cast<char const*>(old.get_alloc()); - char const* new_alloc = reinterpret_cast<char const*>(new_.__get_alloc()); - std::ptrdiff_t old_offset = old_alloc - reinterpret_cast<char const*>(&old); - std::ptrdiff_t new_offset = new_alloc - reinterpret_cast<char const*>(&new_); - assert(new_offset == old_offset && "offset of allocator changed"); - } - - // Make sure both types have the same triviality (that has ABI impact since - // it determined how objects are passed). Both should be non-trivial. - static_assert(std::is_trivially_copyable<New>::value == std::is_trivially_copyable<Old>::value, ""); - static_assert( - std::is_trivially_default_constructible<New>::value == std::is_trivially_default_constructible<Old>::value, ""); -} - -// Object types to store in the control block -struct TrivialEmptyType {}; - -struct alignas(32) OveralignedEmptyType {}; - -struct TrivialNonEmptyType { - char c[11]; -}; - -struct FinalEmptyType final {}; - -struct NonTrivialType { - char c[22]; - NonTrivialType() : c{'x'} {} -}; - -struct VirtualFunctionType { - virtual ~VirtualFunctionType() {} -}; - -// Allocator types -template <class T> -struct TrivialEmptyAlloc { - using value_type = T; - TrivialEmptyAlloc() = default; - template <class U> - TrivialEmptyAlloc(TrivialEmptyAlloc<U>) {} - T* allocate(std::size_t) { return nullptr; } - void deallocate(T*, std::size_t) {} -}; - -template <class T> -struct TrivialNonEmptyAlloc { - char storage[77]; - using value_type = T; - TrivialNonEmptyAlloc() = default; - template <class U> - TrivialNonEmptyAlloc(TrivialNonEmptyAlloc<U>) {} - T* allocate(std::size_t) { return nullptr; } - void deallocate(T*, std::size_t) {} -}; - -template <class T> -struct FinalEmptyAlloc final { - using value_type = T; - FinalEmptyAlloc() = default; - template <class U> - FinalEmptyAlloc(FinalEmptyAlloc<U>) {} - T* allocate(std::size_t) { return nullptr; } - void deallocate(T*, std::size_t) {} -}; - -template <class T> -struct NonTrivialAlloc { - char storage[88]; - using value_type = T; - NonTrivialAlloc() {} - template <class U> - NonTrivialAlloc(NonTrivialAlloc<U>) {} - T* allocate(std::size_t) { return nullptr; } - void deallocate(T*, std::size_t) {} -}; - -int main(int, char**) { - test<TrivialEmptyType, TrivialEmptyAlloc>(); - test<TrivialEmptyType, TrivialNonEmptyAlloc>(); - test<TrivialEmptyType, FinalEmptyAlloc>(); - test<TrivialEmptyType, NonTrivialAlloc>(); - -#if !defined(TEST_HAS_NO_ALIGNED_ALLOCATION) - test<OveralignedEmptyType, TrivialEmptyAlloc>(); - test<OveralignedEmptyType, TrivialNonEmptyAlloc>(); - test<OveralignedEmptyType, FinalEmptyAlloc>(); - test<OveralignedEmptyType, NonTrivialAlloc>(); -#endif - - test<TrivialNonEmptyType, TrivialEmptyAlloc>(); - test<TrivialNonEmptyType, TrivialNonEmptyAlloc>(); - test<TrivialNonEmptyType, FinalEmptyAlloc>(); - test<TrivialNonEmptyType, NonTrivialAlloc>(); - - test<FinalEmptyType, TrivialEmptyAlloc>(); - // FinalEmptyType combined with TrivialNonEmptyAlloc, FinalEmptyAlloc or NonTrivialAlloc is known to have an ABI break - // between LLVM 19 and LLVM 20. It's been deemed not severe enough to cause actual breakage. - - test<NonTrivialType, TrivialEmptyAlloc>(); - test<NonTrivialType, TrivialNonEmptyAlloc>(); - test<NonTrivialType, FinalEmptyAlloc>(); - test<NonTrivialType, NonTrivialAlloc>(); - - test<VirtualFunctionType, TrivialEmptyAlloc>(); - test<VirtualFunctionType, TrivialNonEmptyAlloc>(); - test<VirtualFunctionType, FinalEmptyAlloc>(); - test<VirtualFunctionType, NonTrivialAlloc>(); - - // Test a few real world types just to make sure we didn't mess up badly somehow - test<std::string, std::allocator>(); - test<int, std::allocator>(); - test<std::vector<int>, std::allocator>(); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.array.zero_size.compile.fail.cpp b/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.array.zero_size.compile.fail.cpp deleted file mode 100644 index 3c678d0..0000000 --- a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.array.zero_size.compile.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Make sure that std::allocate_shared<T[0]>(...) fails at compile-time. -// While Clang and GCC appear to support T[0] as a language extension, that support is -// unreliable (for example T[0] doesn't match a T[N] partial specialization on Clang as -// of writing this). So instead, we make sure that this doesn't work at all with our -// implementation. - -#include <memory> - -void f() { - auto p = std::allocate_shared<int[0]>(std::allocator<int[0]>()); - (void)p; -} diff --git a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.array.zero_size.compile.fail.cpp b/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.array.zero_size.compile.fail.cpp deleted file mode 100644 index 35964a5..0000000 --- a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.array.zero_size.compile.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// Make sure that std::make_shared<T[0]>(...) fails at compile-time. -// While Clang and GCC appear to support T[0] as a language extension, that support is -// unreliable (for example T[0] doesn't match a T[N] partial specialization on Clang as -// of writing this). So instead, we make sure that this doesn't work at all with our -// implementation. - -#include <memory> - -void f() { - auto p = std::make_shared<int[0]>(); - (void)p; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/block.objc.pass.mm b/libcxx/test/libcxx-03/utilities/optional/block.objc.pass.mm deleted file mode 100644 index e8ff3a4..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/block.objc.pass.mm +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// REQUIRES: has-fblocks -// ADDITIONAL_COMPILE_FLAGS: -fblocks - -// <optional> - -// This test makes sure that we can create a `std::optional` containing -// an Objective-C++ block. - -#include <optional> -#include <cassert> - -int main(int, char**) -{ - using Block = void (^)(void); - std::optional<Block> block; - assert(!block); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp deleted file mode 100644 index 9df3abb..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <optional> - -// optional<T>& operator=(const optional<T>& rhs); - -#include <optional> -#include <string> -#include <type_traits> - -#include "test_macros.h" - -using std::optional; - -struct X {}; - -struct Y -{ - Y() = default; - Y& operator=(const Y&) { return *this; } -}; - -struct Z1 -{ - Z1() = default; - Z1(Z1&&) = default; - Z1(const Z1&) = default; - Z1& operator=(Z1&&) = default; - Z1& operator=(const Z1&) = delete; -}; - -struct Z2 -{ - Z2() = default; - Z2(Z2&&) = default; - Z2(const Z2&) = delete; - Z2& operator=(Z2&&) = default; - Z2& operator=(const Z2&) = default; -}; - -template <class T> -constexpr bool -test() -{ - optional<T> opt; - optional<T> opt2; - opt = opt2; - return true; -} - -int main(int, char**) -{ - { - using T = int; - static_assert((std::is_trivially_copy_assignable<optional<T>>::value), ""); - static_assert(test<T>(), ""); - } - { - using T = X; - static_assert((std::is_trivially_copy_assignable<optional<T>>::value), ""); - static_assert(test<T>(), ""); - } - static_assert(!(std::is_trivially_copy_assignable<optional<Y>>::value), ""); - static_assert(!(std::is_trivially_copy_assignable<optional<std::string>>::value), ""); - - static_assert(!(std::is_copy_assignable<optional<Z1>>::value), ""); - static_assert(!(std::is_copy_assignable<optional<Z2>>::value), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.assign/move.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.assign/move.pass.cpp deleted file mode 100644 index f0d7e68..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.assign/move.pass.cpp +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <optional> - -// optional<T>& operator=(optional<T>&& rhs); - -#include <optional> -#include <string> -#include <type_traits> -#include <utility> - -#include "test_macros.h" - -using std::optional; - -struct X {}; - -struct Y -{ - Y() = default; - Y& operator=(Y&&) { return *this; } -}; - -struct Z1 -{ - Z1() = default; - Z1(Z1&&) = default; - Z1& operator=(Z1&&) = delete; -}; - -struct Z2 -{ - Z2() = default; - Z2(Z2&&) = delete; - Z2& operator=(Z2&&) = default; -}; - -template <class T> -constexpr bool -test() -{ - optional<T> opt; - optional<T> opt2; - opt = std::move(opt2); - return true; -} - -int main(int, char**) -{ - { - using T = int; - static_assert((std::is_trivially_copy_constructible<optional<T>>::value), ""); - static_assert(test<T>(), ""); - } - { - using T = X; - static_assert((std::is_trivially_copy_constructible<optional<T>>::value), ""); - static_assert(test<T>(), ""); - } - static_assert(!(std::is_trivially_move_assignable<optional<Y>>::value), ""); - static_assert(!(std::is_trivially_move_assignable<optional<std::string>>::value), ""); - - static_assert(!(std::is_move_assignable<optional<Z1>>::value), ""); - static_assert(!(std::is_move_assignable<optional<Z2>>::value), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp deleted file mode 100644 index 38f611b..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <optional> - -// optional(const optional<T>& rhs); - -#include <optional> -#include <string> -#include <type_traits> - -#include "test_macros.h" - -using std::optional; - -struct X {}; - -struct Y -{ - Y() = default; - Y(const Y&) {} -}; - -struct Z -{ - Z() = default; - Z(Z&&) = delete; - Z(const Z&) = delete; - Z& operator=(Z&&) = delete; - Z& operator=(const Z&) = delete; -}; - -int main(int, char**) -{ - { - using T = int; - static_assert((std::is_trivially_copy_constructible<optional<T>>::value), ""); - constexpr optional<T> opt; - constexpr optional<T> opt2 = opt; - (void)opt2; - } - { - using T = X; - static_assert((std::is_trivially_copy_constructible<optional<T>>::value), ""); - constexpr optional<T> opt; - constexpr optional<T> opt2 = opt; - (void)opt2; - } - static_assert(!(std::is_trivially_copy_constructible<optional<Y>>::value), ""); - static_assert(!(std::is_trivially_copy_constructible<optional<std::string>>::value), ""); - - static_assert(!(std::is_copy_constructible<optional<Z>>::value), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp deleted file mode 100644 index 76b7b9f3..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <optional> - -// optional(optional<T>&& rhs); - -#include <optional> -#include <string> -#include <type_traits> -#include <utility> - -#include "test_macros.h" - -using std::optional; - -struct X {}; - -struct Y -{ - Y() = default; - Y(Y&&) {} -}; - -struct Z -{ - Z() = default; - Z(Z&&) = delete; - Z(const Z&) = delete; - Z& operator=(Z&&) = delete; - Z& operator=(const Z&) = delete; -}; - -int main(int, char**) -{ - { - using T = int; - static_assert((std::is_trivially_copy_constructible<optional<T>>::value), ""); - constexpr optional<T> opt; - constexpr optional<T> opt2 = std::move(opt); - (void)opt2; - } - { - using T = X; - static_assert((std::is_trivially_copy_constructible<optional<T>>::value), ""); - constexpr optional<T> opt; - constexpr optional<T> opt2 = std::move(opt); - (void)opt2; - } - static_assert(!(std::is_trivially_move_constructible<optional<Y>>::value), ""); - static_assert(!(std::is_trivially_move_constructible<optional<std::string>>::value), ""); - - static_assert(!(std::is_move_constructible<optional<Z>>::value), ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp deleted file mode 100644 index 31938b3..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.observe/assert.dereference.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <optional> - -// constexpr T& optional<T>::operator*() &; -// constexpr T&& optional<T>::operator*() &&; -// constexpr const T& optional<T>::operator*() const &; -// constexpr T&& optional<T>::operator*() const &&; - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <optional> - -#include "check_assertion.h" - -int main(int, char**) { - // & - { - std::optional<int> opt; - TEST_LIBCPP_ASSERT_FAILURE(*opt, "optional operator* called on a disengaged value"); - } - - // && - { - std::optional<int> opt; - TEST_LIBCPP_ASSERT_FAILURE(*std::move(opt), "optional operator* called on a disengaged value"); - } - - // const & - { - const std::optional<int> opt; - TEST_LIBCPP_ASSERT_FAILURE(*opt, "optional operator* called on a disengaged value"); - } - - // const && - { - const std::optional<int> opt; - TEST_LIBCPP_ASSERT_FAILURE(*std::move(opt), "optional operator* called on a disengaged value"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp deleted file mode 100644 index 5200962..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional.object.observe/assert.op_arrow.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <optional> - -// constexpr T* optional<T>::operator->(); -// constexpr const T* optional<T>::operator->() const; - -// REQUIRES: has-unix-headers -// UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: libcpp-hardening-mode=none -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <optional> - -#include "check_assertion.h" - -struct X { - int test() const { return 3; } -}; - -int main(int, char**) { - { - std::optional<X> opt; - TEST_LIBCPP_ASSERT_FAILURE(opt->test(), "optional operator-> called on a disengaged value"); - } - - { - const std::optional<X> opt; - TEST_LIBCPP_ASSERT_FAILURE(opt->test(), "optional operator-> called on a disengaged value"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional_size.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/optional_size.pass.cpp deleted file mode 100644 index b928ed7..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/optional_size.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <optional> - -// template <class T> class optional; - -#include <optional> - -template <class T> -struct type_with_bool { - T value; - bool has_value; -}; - -int main(int, char**) { - // Test that std::optional achieves the expected size. See https://llvm.org/PR61095. - static_assert(sizeof(std::optional<char>) == sizeof(type_with_bool<char>)); - static_assert(sizeof(std::optional<int>) == sizeof(type_with_bool<int>)); - static_assert(sizeof(std::optional<long>) == sizeof(type_with_bool<long>)); - static_assert(sizeof(std::optional<std::size_t>) == sizeof(type_with_bool<std::size_t>)); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/optional/optional.object/triviality.abi.pass.cpp b/libcxx/test/libcxx-03/utilities/optional/optional.object/triviality.abi.pass.cpp deleted file mode 100644 index 7d86878..0000000 --- a/libcxx/test/libcxx-03/utilities/optional/optional.object/triviality.abi.pass.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <optional> - -// This test asserts the triviality of special member functions of optional<T> -// whenever T has these special member functions trivial. The goal of this test -// is to make sure that we do not change the triviality of those, since that -// constitutes an ABI break (small enough optionals would be passed by registers). -// -// constexpr optional(const optional& rhs); -// constexpr optional(optional&& rhs) noexcept(see below); -// constexpr optional<T>& operator=(const optional& rhs); -// constexpr optional<T>& operator=(optional&& rhs) noexcept(see below); - -#include <optional> -#include <type_traits> -#include <cassert> - -#include "archetypes.h" - -#include "test_macros.h" - -template <class T> -struct SpecialMemberTest { - using O = std::optional<T>; - - static_assert(std::is_trivially_destructible_v<O> == - std::is_trivially_destructible_v<T>, - "optional<T> is trivially destructible if and only if T is."); - - static_assert(std::is_trivially_copy_constructible_v<O> == - std::is_trivially_copy_constructible_v<T>, - "optional<T> is trivially copy constructible if and only if T is."); - - static_assert(std::is_trivially_move_constructible_v<O> == - std::is_trivially_move_constructible_v<T> || - (!std::is_move_constructible_v<T> && std::is_trivially_copy_constructible_v<T>), - "optional<T> is trivially move constructible if T is trivially move constructible, " - "or if T is trivially copy constructible and is not move constructible."); - - static_assert(std::is_trivially_copy_assignable_v<O> == - (std::is_trivially_destructible_v<T> && - std::is_trivially_copy_constructible_v<T> && - std::is_trivially_copy_assignable_v<T>), - "optional<T> is trivially copy assignable if and only if T is trivially destructible, " - "trivially copy constructible, and trivially copy assignable."); - - static_assert(std::is_trivially_move_assignable_v<O> == - (std::is_trivially_destructible_v<T> && - ((std::is_trivially_move_constructible_v<T> && std::is_trivially_move_assignable_v<T>) || - ((!std::is_move_constructible_v<T> || !std::is_move_assignable_v<T>) && - std::is_trivially_copy_constructible_v<T> && std::is_trivially_copy_assignable_v<T>))), - "optional<T> is trivially move assignable if T is trivially destructible, and either " - "(1) trivially move constructible and trivially move assignable, or " - "(2) not move constructible or not move assignable, and " - "trivially copy constructible and trivially copy assignable."); -}; - -template <class ...Args> static void sink(Args&&...) {} - -template <class ...TestTypes> -struct DoTestsMetafunction { - DoTestsMetafunction() { sink(SpecialMemberTest<TestTypes>{}...); } -}; - -struct TrivialMoveNonTrivialCopy { - TrivialMoveNonTrivialCopy() = default; - TrivialMoveNonTrivialCopy(const TrivialMoveNonTrivialCopy&) {} - TrivialMoveNonTrivialCopy(TrivialMoveNonTrivialCopy&&) = default; - TrivialMoveNonTrivialCopy& operator=(const TrivialMoveNonTrivialCopy&) { return *this; } - TrivialMoveNonTrivialCopy& operator=(TrivialMoveNonTrivialCopy&&) = default; -}; - -struct TrivialCopyNonTrivialMove { - TrivialCopyNonTrivialMove() = default; - TrivialCopyNonTrivialMove(const TrivialCopyNonTrivialMove&) = default; - TrivialCopyNonTrivialMove(TrivialCopyNonTrivialMove&&) {} - TrivialCopyNonTrivialMove& operator=(const TrivialCopyNonTrivialMove&) = default; - TrivialCopyNonTrivialMove& operator=(TrivialCopyNonTrivialMove&&) { return *this; } -}; - -int main(int, char**) -{ - sink( - ImplicitTypes::ApplyTypes<DoTestsMetafunction>{}, - ExplicitTypes::ApplyTypes<DoTestsMetafunction>{}, - NonLiteralTypes::ApplyTypes<DoTestsMetafunction>{}, - NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{}, - DoTestsMetafunction<TrivialMoveNonTrivialCopy, TrivialCopyNonTrivialMove>{} - ); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/smartptr/unique.ptr/null.pass.cpp b/libcxx/test/libcxx-03/utilities/smartptr/unique.ptr/null.pass.cpp deleted file mode 100644 index 51e5ec7..0000000 --- a/libcxx/test/libcxx-03/utilities/smartptr/unique.ptr/null.pass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <memory> - -// unique_ptr - -// FIXME(EricWF): This test contains tests for constructing a unique_ptr from NULL. -// The behavior demonstrated in this test is not meant to be standard; It simply -// tests the current status quo in libc++. - -#include <memory> -#include <cassert> - -#include "test_macros.h" -#include "unique_ptr_test_helper.h" - -template <class VT> -TEST_CONSTEXPR_CXX23 void test_pointer_ctor() { - { - std::unique_ptr<VT> p(0); - assert(p.get() == 0); - } - { - std::unique_ptr<VT, Deleter<VT> > p(0); - assert(p.get() == 0); - assert(p.get_deleter().state() == 0); - } -} - -template <class VT> -TEST_CONSTEXPR_CXX23 void test_pointer_deleter_ctor() { - { - std::default_delete<VT> d; - std::unique_ptr<VT> p(0, d); - assert(p.get() == 0); - } - { - std::unique_ptr<VT, Deleter<VT> > p(0, Deleter<VT>(5)); - assert(p.get() == 0); - assert(p.get_deleter().state() == 5); - } - { - NCDeleter<VT> d(5); - std::unique_ptr<VT, NCDeleter<VT>&> p(0, d); - assert(p.get() == 0); - assert(p.get_deleter().state() == 5); - } - { - NCConstDeleter<VT> d(5); - std::unique_ptr<VT, NCConstDeleter<VT> const&> p(0, d); - assert(p.get() == 0); - assert(p.get_deleter().state() == 5); - } -} - -TEST_CONSTEXPR_CXX23 bool test() { - { - // test_pointer_ctor<int>(); - test_pointer_deleter_ctor<int>(); - } - { - test_pointer_ctor<int[]>(); - test_pointer_deleter_ctor<int[]>(); - } - - return true; -} - -int main(int, char**) { - test(); -#if TEST_STD_VER >= 23 - static_assert(test()); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/template.bitset/assert.pass.cpp b/libcxx/test/libcxx-03/utilities/template.bitset/assert.pass.cpp deleted file mode 100644 index 4019bdf..0000000 --- a/libcxx/test/libcxx-03/utilities/template.bitset/assert.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <bitset> - -// Test hardening assertions for std::bitset. - -// REQUIRES: has-unix-headers -// UNSUPPORTED: libcpp-hardening-mode=none -// UNSUPPORTED: c++03 -// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing - -#include <bitset> - -#include "check_assertion.h" - -int main(int, char**) { - { // Empty bitset - std::bitset<0> c; - const auto& const_c = c; - TEST_LIBCPP_ASSERT_FAILURE(c[0], "bitset::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(const_c[0], "bitset::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(c[42], "bitset::operator[] index out of bounds"); - TEST_LIBCPP_ASSERT_FAILURE(const_c[42], "bitset::operator[] index out of bounds"); - } - - { // Non-empty bitset - std::bitset<4> c(42); - const auto& const_c = c; - (void)c[3]; // Check that there's no assertion on valid access. - TEST_LIBCPP_ASSERT_FAILURE(c[4], "bitset::operator[] index out of bounds"); - (void)const_c[3]; // Check that there's no assertion on valid access. - TEST_LIBCPP_ASSERT_FAILURE(const_c[4], "bitset::operator[] index out of bounds"); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/tuple/__tuple_like.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/tuple/__tuple_like.compile.pass.cpp deleted file mode 100644 index afce298..0000000 --- a/libcxx/test/libcxx-03/utilities/tuple/__tuple_like.compile.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// <tuple> - -// 22.4.3 Concept `tuple-like` [tuple.like] -// -// template<class T> -// concept tuple-like; // exposition only - -#include <__tuple/tuple_like.h> -#include <array> -#include <complex> -#include <cstddef> -#include <ranges> -#include <tuple> - -#include "test_iterators.h" - -// Non-tuple-like type - -static_assert(!std::__tuple_like<int>); - -// Tuple-like: array - -static_assert(std::__tuple_like<std::array<int, 0>>); -static_assert(std::__tuple_like<std::array<int, 1>>); -static_assert(std::__tuple_like<std::array<int, 2>>); -static_assert(std::__tuple_like<std::array<int, 2728>>); - -// Tuple-like: complex - -#if _LIBCPP_STD_VER >= 26 -static_assert(std::__tuple_like<std::complex<float>>); -static_assert(std::__tuple_like<std::complex<double>>); -static_assert(std::__tuple_like<std::complex<long double>>); -#endif - -// Tuple-like: pair - -static_assert(std::__tuple_like<std::pair<int, float>>); - -// Tuple-like: tuple - -static_assert(std::__tuple_like<std::tuple<int>>); -static_assert(std::__tuple_like<std::tuple<int, float>>); -static_assert(std::__tuple_like<std::tuple<int, float, double>>); - -// Support for <ranges> - -using FI = forward_iterator<int*>; -static_assert(std::__tuple_like<std::ranges::subrange<FI, FI, std::ranges::subrange_kind::sized>>); -static_assert(std::__tuple_like<std::ranges::subrange<FI, FI, std::ranges::subrange_kind::unsized>>); -static_assert(std::__tuple_like<std::ranges::subrange<int*, int*, std::ranges::subrange_kind::sized>>); -static_assert(std::__tuple_like<std::ranges::subrange<int*, std::nullptr_t, std::ranges::subrange_kind::unsized>>); - -template <typename Iter> -void test_subrange_sized() { - static_assert(std::__tuple_like<std::ranges::subrange<Iter, Iter, std::ranges::subrange_kind::sized>>); -} - -template <typename Iter> -void test_subrange_unsized() { - static_assert(std::__tuple_like<std::ranges::subrange<Iter, Iter, std::ranges::subrange_kind::unsized>>); -} - -void test() { - test_subrange_sized<forward_iterator<int*>>(); - test_subrange_sized<bidirectional_iterator<int*>>(); - test_subrange_sized<random_access_iterator<int*>>(); - test_subrange_sized<contiguous_iterator<int*>>(); - test_subrange_sized<int*>(); - - test_subrange_sized<forward_iterator<int const*>>(); - test_subrange_sized<bidirectional_iterator<int const*>>(); - test_subrange_sized<random_access_iterator<int const*>>(); - test_subrange_sized<contiguous_iterator<int const*>>(); - test_subrange_sized<int const*>(); - - test_subrange_unsized<forward_iterator<int*>>(); - test_subrange_unsized<bidirectional_iterator<int*>>(); - static_assert(std::__tuple_like<std::ranges::subrange<int*, std::nullptr_t, std::ranges::subrange_kind::unsized>>); - - test_subrange_unsized<forward_iterator<int const*>>(); - test_subrange_unsized<bidirectional_iterator<int const*>>(); - static_assert( - std::__tuple_like<std::ranges::subrange<const int*, std::nullptr_t, std::ranges::subrange_kind::unsized>>); -} diff --git a/libcxx/test/libcxx-03/utilities/tuple/no_specializations.verify.cpp b/libcxx/test/libcxx-03/utilities/tuple/no_specializations.verify.cpp deleted file mode 100644 index 783bd81..0000000 --- a/libcxx/test/libcxx-03/utilities/tuple/no_specializations.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// REQUIRES: std-at-least-c++11 - -// Check that user-specializations are diagnosed -// See [tuple.tuple.general]/1 - -#include <tuple> - -#if !__has_warning("-Winvalid-specialization") -// expected-no-diagnostics -#else -struct S {}; - -template <> -class std::tuple<S>; // expected-error {{cannot be specialized}} -#endif diff --git a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/empty_member.pass.cpp b/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/empty_member.pass.cpp deleted file mode 100644 index ee47e62..0000000 --- a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/empty_member.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <tuple> - -// template <class... Types> class tuple; - -// UNSUPPORTED: c++03 - -// This is not a portable test - -#include <tuple> - -#include "test_macros.h" - -struct A {}; - -struct B {}; - -int main(int, char**) -{ - { - typedef std::tuple<int, A> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<A, int> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<A, int, B> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<A, B, int> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<int, A, B> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.assign/array.extension.pass.cpp b/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.assign/array.extension.pass.cpp deleted file mode 100644 index c7847e3..0000000 --- a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.assign/array.extension.pass.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <tuple> - -// template <class... Types> class tuple; - -// EXTENSION -// template <class U, size_t N> -// tuple& operator=(const array<U, N>& u); -// -// template <class U, size_t N> -// tuple& operator=(array<U, N>&& u); - -// UNSUPPORTED: c++03 - -#include <array> -#include <cassert> -#include <tuple> -#include <type_traits> -#include <utility> - - -template <class T> -struct NothrowAssignableFrom { - NothrowAssignableFrom& operator=(T) noexcept { return *this; } -}; - -template <class T> -struct PotentiallyThrowingAssignableFrom { - PotentiallyThrowingAssignableFrom& operator=(T) { return *this; } -}; - -int main(int, char**) { - // Tests for the array const& overload - { - std::array<long, 3> array = {1l, 2l, 3l}; - std::tuple<int, int, int> tuple; - tuple = array; - assert(std::get<0>(tuple) == 1); - assert(std::get<1>(tuple) == 2); - assert(std::get<2>(tuple) == 3); - } - { - typedef std::tuple<NothrowAssignableFrom<int>> Tuple; - typedef std::array<int, 1> Array; - static_assert(std::is_nothrow_assignable<Tuple&, Array const&>::value, ""); - } - { - typedef std::tuple<PotentiallyThrowingAssignableFrom<int>> Tuple; - typedef std::array<int, 1> Array; - static_assert(std::is_assignable<Tuple&, Array const&>::value, ""); - static_assert(!std::is_nothrow_assignable<Tuple&, Array const&>::value, ""); - } - - // Tests for the array&& overload - { - std::array<long, 3> array = {1l, 2l, 3l}; - std::tuple<int, int, int> tuple; - tuple = std::move(array); - assert(std::get<0>(tuple) == 1); - assert(std::get<1>(tuple) == 2); - assert(std::get<2>(tuple) == 3); - } - { - typedef std::tuple<NothrowAssignableFrom<int>> Tuple; - typedef std::array<int, 1> Array; - static_assert(std::is_nothrow_assignable<Tuple&, Array&&>::value, ""); - } - { - typedef std::tuple<PotentiallyThrowingAssignableFrom<int>> Tuple; - typedef std::array<int, 1> Array; - static_assert(std::is_assignable<Tuple&, Array&&>::value, ""); - static_assert(!std::is_nothrow_assignable<Tuple&, Array&&>::value, ""); - } - - // Test lvalue-refs and const rvalue-ref - { - typedef std::tuple<NothrowAssignableFrom<int>> Tuple; - typedef std::array<int, 1> Array; - static_assert(std::is_nothrow_assignable<Tuple&, Array&>::value, ""); - static_assert(std::is_nothrow_assignable<Tuple&, const Array&&>::value, ""); - } - - { - typedef std::tuple<NothrowAssignableFrom<int>> Tuple; - static_assert(!std::is_assignable<Tuple&, std::array<long, 2>&>::value, ""); - static_assert(!std::is_assignable<Tuple&, std::array<long, 2>&&>::value, ""); - static_assert(!std::is_assignable<Tuple&, const std::array<long, 2>&>::value, ""); - static_assert(!std::is_assignable<Tuple&, const std::array<long, 2>&&>::value, ""); - - static_assert(!std::is_assignable<Tuple&, std::array<long, 4>&>::value, ""); - static_assert(!std::is_assignable<Tuple&, std::array<long, 4>&&>::value, ""); - static_assert(!std::is_assignable<Tuple&, const std::array<long, 4>&>::value, ""); - static_assert(!std::is_assignable<Tuple&, const std::array<long, 4>&&>::value, ""); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp b/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp deleted file mode 100644 index b5a234e..0000000 --- a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <tuple> - -// template <class... Types> class tuple; - -// template <tuple-like Tuple> -// tuple & operator=(Tuple &&); - -// This test checks that we do not evaluate __make_tuple_types -// on the array when it doesn't match the size of the tuple. - -#include <array> -#include <tuple> - -#include "test_macros.h" - -// Use 1256 to try and blow the template instantiation depth for all compilers. -typedef std::array<char, 1256> array_t; -typedef std::tuple<array_t> tuple_t; - -int main(int, char**) -{ - array_t arr; - tuple_t tup; - tup = arr; - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.verify.cpp b/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.verify.cpp deleted file mode 100644 index a1a8048..0000000 --- a/libcxx/test/libcxx-03/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.verify.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <tuple> - -// See https://llvm.org/PR20855 - -#include <tuple> -#include <string> - -#include "test_macros.h" - -template <class Tp> -struct ConvertsTo { - using RawTp = typename std::remove_cv< typename std::remove_reference<Tp>::type>::type; - - operator Tp() const { - return static_cast<Tp>(value); - } - - mutable RawTp value; -}; - -struct Base {}; -struct Derived : Base {}; - -template <class T> struct CannotDeduce { - using type = T; -}; - -template <class ...Args> -void F(typename CannotDeduce<std::tuple<Args...>>::type const&) {} - -void f() { - // Test that we emit our diagnostic from the library. - // expected-error@tuple:* 8 {{Attempted construction of reference element binds to a temporary whose lifetime has ended}} - - // Good news everybody! Clang now diagnoses this for us! - // expected-error@tuple:* 0+ {{reference member '__value_' binds to a temporary object whose lifetime would be shorter than the lifetime of the constructed object}} - - { - F<int, const std::string&>(std::make_tuple(1, "abc")); // expected-note 1 {{requested here}} - } - { - std::tuple<int, const std::string&> t(1, "a"); // expected-note 1 {{requested here}} - } - { - F<int, const std::string&>(std::tuple<int, const std::string&>(1, "abc")); // expected-note 1 {{requested here}} - } - { - ConvertsTo<int&> ct; - std::tuple<const long&, int> t(ct, 42); // expected-note {{requested here}} - } - { - ConvertsTo<int> ct; - std::tuple<int const&, void*> t(ct, nullptr); // expected-note {{requested here}} - } - { - ConvertsTo<Derived> ct; - std::tuple<Base const&, int> t(ct, 42); // expected-note {{requested here}} - } - { - std::allocator<int> alloc; - std::tuple<std::string &&> t2("hello"); // expected-note {{requested here}} - std::tuple<std::string &&> t3(std::allocator_arg, alloc, "hello"); // expected-note {{requested here}} - } -} diff --git a/libcxx/test/libcxx-03/utilities/utility/__is_inplace_index.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/__is_inplace_index.pass.cpp deleted file mode 100644 index e26f515..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/__is_inplace_index.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// template <class _Tp> using __is_inplace_index - -#include <utility> - -#include "test_macros.h" - -struct S {}; - -int main(int, char**) { - using I = std::in_place_index_t<0>; - static_assert( std::__is_inplace_index<I>::value, ""); - static_assert( std::__is_inplace_index<const I>::value, ""); - static_assert( std::__is_inplace_index<const volatile I>::value, ""); - static_assert( std::__is_inplace_index<I&>::value, ""); - static_assert( std::__is_inplace_index<const I&>::value, ""); - static_assert( std::__is_inplace_index<const volatile I&>::value, ""); - static_assert( std::__is_inplace_index<I&&>::value, ""); - static_assert( std::__is_inplace_index<const I&&>::value, ""); - static_assert( std::__is_inplace_index<const volatile I&&>::value, ""); - static_assert(!std::__is_inplace_index<std::in_place_type_t<int>>::value, ""); - static_assert(!std::__is_inplace_index<std::in_place_t>::value, ""); - static_assert(!std::__is_inplace_index<void>::value, ""); - static_assert(!std::__is_inplace_index<int>::value, ""); - static_assert(!std::__is_inplace_index<S>::value, ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/__is_inplace_type.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/__is_inplace_type.pass.cpp deleted file mode 100644 index 1179067..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/__is_inplace_type.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// template <class _Tp> using __is_inplace_type - -#include <utility> - -#include "test_macros.h" - -struct S {}; - -int main(int, char**) { - using T = std::in_place_type_t<int>; - static_assert( std::__is_inplace_type<T>::value, ""); - static_assert( std::__is_inplace_type<const T>::value, ""); - static_assert( std::__is_inplace_type<const volatile T>::value, ""); - static_assert( std::__is_inplace_type<T&>::value, ""); - static_assert( std::__is_inplace_type<const T&>::value, ""); - static_assert( std::__is_inplace_type<const volatile T&>::value, ""); - static_assert( std::__is_inplace_type<T&&>::value, ""); - static_assert( std::__is_inplace_type<const T&&>::value, ""); - static_assert( std::__is_inplace_type<const volatile T&&>::value, ""); - static_assert(!std::__is_inplace_type<std::in_place_index_t<0>>::value, ""); - static_assert(!std::__is_inplace_type<std::in_place_t>::value, ""); - static_assert(!std::__is_inplace_type<void>::value, ""); - static_assert(!std::__is_inplace_type<int>::value, ""); - static_assert(!std::__is_inplace_type<S>::value, ""); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp deleted file mode 100644 index 649ff18..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/__murmur2_or_cityhash.abi-v1.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Test that the CityHash implementation returns the results we expect. -// -// Note that this implementation is technically incorrect, however changing it is -// an ABI break. This test ensures that we don't unintentionally break the ABI v1 -// by "fixing" the hash implementation. -// REQUIRES: libcpp-abi-version=1 - -#include <cassert> -#include <cstdint> -#include <string> -#include <utility> - -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define CHOOSE_BY_ENDIANESS(little, big) (little) -#else -# define CHOOSE_BY_ENDIANESS(little, big) (big) -#endif - -std::string CityHash[] = { - {/* "abcdefgh" */ "\x61\x62\x63\x64\x65\x66\x67\x68"}, - {/* "abcDefgh" */ "\x61\x62\x63\x44\x65\x66\x67\x68"}, - {/* "CityHash" */ "\x43\x69\x74\x79\x48\x61\x73\x68"}, - {/* "CitYHash" */ "\x43\x69\x74\x59\x48\x61\x73\x68"}, -}; - -int main(int, char**) { - const std::pair<std::string, std::uint64_t> TestCases[] = { - {CityHash[0], CHOOSE_BY_ENDIANESS(0x87c69099911bab7eULL, 0x297621d7fa436a3ULL)}, - {CityHash[1], CHOOSE_BY_ENDIANESS(0x87c69099911bab7eULL, 0xb17be531dde56e57ULL)}, - {CityHash[2], CHOOSE_BY_ENDIANESS(0x85322632e188694aULL, 0xe14f578b688e266dULL)}, - {CityHash[3], CHOOSE_BY_ENDIANESS(0x85322632e188694aULL, 0xca5a764a0450eac6ULL)}, - }; - - std::__murmur2_or_cityhash<std::uint64_t> h64; - for (const auto& test_case : TestCases) { - assert(h64(test_case.first.data(), test_case.first.size()) == test_case.second); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp deleted file mode 100644 index 25c0b9f..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/__murmur2_or_cityhash.abi-v2.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// Test that the CityHash implementation is correct. -// -// In ABI v1, our CityHash implementation is incorrect and fixing it would -// be an ABI break. -// REQUIRES: libcpp-abi-version=2 - -#include <cassert> -#include <string> -#include <utility> - -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define CHOOSE_BY_ENDIANESS(little, big) (little) -#else -# define CHOOSE_BY_ENDIANESS(little, big) (big) -#endif - -std::string CityHash[] = { - {/* "abcdefgh" */ "\x61\x62\x63\x64\x65\x66\x67\x68"}, - {/* "abcDefgh" */ "\x61\x62\x63\x44\x65\x66\x67\x68"}, - {/* "CityHash" */ "\x43\x69\x74\x79\x48\x61\x73\x68"}, - {/* "CitYHash" */ "\x43\x69\x74\x59\x48\x61\x73\x68"}, -}; - -int main(int, char**) { - const std::pair<std::string, std::uint64_t> TestCases[] = { - {CityHash[0], CHOOSE_BY_ENDIANESS(0x4382a8d0fe8edb17ULL, 0xca84e809bef16fbcULL)}, - {CityHash[1], CHOOSE_BY_ENDIANESS(0xecefb080a6854061ULL, 0xd7feb824250272dcULL)}, - {CityHash[2], CHOOSE_BY_ENDIANESS(0x169ea3aebf908d6dULL, 0xea8cef3ca6f6e368ULL)}, - {CityHash[3], CHOOSE_BY_ENDIANESS(0xe18298a2760f09faULL, 0xf33a7700bb7a94a8ULL)}, - }; - - std::__murmur2_or_cityhash<std::uint64_t> h64; - for (const auto& test_case : TestCases) { - assert(h64(test_case.first.data(), test_case.first.size()) == test_case.second); - } - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/forward/lifetimebound.verify.cpp b/libcxx/test/libcxx-03/utilities/utility/forward/lifetimebound.verify.cpp deleted file mode 100644 index 4381c3a..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/forward/lifetimebound.verify.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// ADDITIONAL_COMPILE_FLAGS: -Wno-pessimizing-move -Wno-unused-variable - -#include <utility> - -#include "test_macros.h" - -struct S { - const int& func() [[clang::lifetimebound]]; -}; - -void func() { - auto&& v1 = std::move(int{}); // expected-warning {{temporary bound to local reference 'v1' will be destroyed at the end of the full-expression}} - auto&& v2 = std::forward<int&&>(int{}); // expected-warning {{temporary bound to local reference 'v2' will be destroyed at the end of the full-expression}} - auto&& v3 = std::forward<const int&>(S{}.func()); // expected-warning {{temporary bound to local reference 'v3' will be destroyed at the end of the full-expression}} - auto&& v4 = std::move_if_noexcept<const int&>(S{}.func()); // expected-warning {{temporary bound to local reference 'v4' will be destroyed at the end of the full-expression}} -#if TEST_STD_VER >= 23 - auto&& v5 = std::forward_like<int&&>(int{}); // expected-warning {{temporary bound to local reference 'v5' will be destroyed at the end of the full-expression}} -#endif -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/allocate_vocabulary.attributes.verify.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/allocate_vocabulary.attributes.verify.cpp deleted file mode 100644 index d5cd62ec..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/allocate_vocabulary.attributes.verify.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// check that clang warns on non-power-of-two alignment - -#include <memory_resource> - -void func() { - std::pmr::polymorphic_allocator<> allocator; - (void)allocator.allocate_bytes(0, 3); // expected-warning {{requested alignment is not a power of 2}} - -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/assert.deallocate.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/assert.deallocate.pass.cpp deleted file mode 100644 index 5a9813a..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/assert.deallocate.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// REQUIRES: has-unix-headers, libcpp-hardening-mode=debug - -// <memory_resource> - -// template <class T> class polymorphic_allocator - -// T* polymorphic_allocator<T>::deallocate(T*, size_t size) - -int AssertCount = 0; - -#include <memory_resource> -#include <type_traits> -#include <cassert> - -#include "check_assertion.h" -#include "test_std_memory_resource.h" - -int main(int, char**) { - using Alloc = std::pmr::polymorphic_allocator<int>; - using Traits = std::allocator_traits<Alloc>; - NullResource R; - Alloc a(&R); - const std::size_t maxSize = Traits::max_size(a); - - a.deallocate(nullptr, maxSize); // no assertion - TEST_LIBCPP_ASSERT_FAILURE( - a.deallocate(nullptr, maxSize + 1), - "deallocate() called for a size which exceeds max_size(), leading to a memory leak " - "(the argument will overflow and result in too few objects being deleted)"); - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_piecewise_pair.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_piecewise_pair.pass.cpp deleted file mode 100644 index 55a51c9..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.poly.allocator.class/mem.poly.allocator.mem/construct_piecewise_pair.pass.cpp +++ /dev/null @@ -1,170 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed -// UNSUPPORTED: availability-pmr-missing - -// test_memory_resource requires RTTI for dynamic_cast -// UNSUPPORTED: no-rtti - -// <memory_resource> - -// template <class T> class polymorphic_allocator - -// template <class U1, class U2, class ...Args1, class ...Args2> -// void polymorphic_allocator<T>::construct(pair<T1, T2>*, piecewise_construct_t -// tuple<Args1...> x, tuple<Args2...>) - -// The standard specifies a transformation to uses-allocator construction as -// follows: -// - If uses_allocator_v<T1,memory_resource*> is false and -// is_constructible_v<T,Args1...> is true, then xprime is x. -// - Otherwise, if uses_allocator_v<T1,memory_resource*> is true and -// is_constructible_v<T1,allocator_arg_t,memory_resource*,Args1...> is true, -// then xprime is -// tuple_cat(make_tuple(allocator_arg, this->resource()), std::move(x)). -// - Otherwise, if uses_allocator_v<T1,memory_resource*> is true and -// is_constructible_v<T1,Args1...,memory_resource*> is true, then xprime is -// tuple_cat(std::move(x), make_tuple(this->resource())). -// - Otherwise the program is ill formed. -// -// The use of "xprime = tuple_cat(..., std::move(x), ...)" causes all of the -// objects in 'x' to be copied into 'xprime'. If 'x' contains any types which -// are stored by value this causes an unnecessary copy to occur. To prevent this -// libc++ changes this call into -// "xprime = forward_as_tuple(..., std::get<Idx>(std::move(x))..., ...)". -// 'xprime' contains references to the values in 'x' instead of copying them. - -// This test checks the number of copies incurred to the elements in -// 'tuple<Args1...>' and 'tuple<Args2...>'. - -#include <memory_resource> -#include <type_traits> -#include <utility> -#include <tuple> -#include <cassert> -#include <cstdlib> -#include "test_std_memory_resource.h" - -template <class T> -struct TestHarness { - TestResource R; - std::pmr::memory_resource* M = &R; - std::pmr::polymorphic_allocator<T> A = M; - bool constructed = false; - T* ptr; - - TestHarness() : ptr(A.allocate(1)) {} - - template <class... Args> - void construct(Args&&... args) { - A.construct(ptr, std::forward<Args>(args)...); - constructed = true; - } - - ~TestHarness() { - if (constructed) - A.destroy(ptr); - A.deallocate(ptr, 1); - } -}; - -struct CountCopies { - int count; - CountCopies() : count(0) {} - CountCopies(CountCopies const& o) : count(o.count + 1) {} -}; - -struct CountCopiesAllocV1 { - typedef std::pmr::polymorphic_allocator<char> allocator_type; - std::pmr::memory_resource* alloc; - int count; - CountCopiesAllocV1() : alloc(nullptr), count(0) {} - CountCopiesAllocV1(std::allocator_arg_t, allocator_type const& a, CountCopiesAllocV1 const& o) - : alloc(a.resource()), count(o.count + 1) {} - - CountCopiesAllocV1(CountCopiesAllocV1 const& o) : count(o.count + 1) {} -}; - -struct CountCopiesAllocV2 { - typedef std::pmr::polymorphic_allocator<char> allocator_type; - std::pmr::memory_resource* alloc; - int count; - CountCopiesAllocV2() : alloc(nullptr), count(0) {} - CountCopiesAllocV2(CountCopiesAllocV2 const& o, allocator_type const& a) : alloc(a.resource()), count(o.count + 1) {} - - CountCopiesAllocV2(CountCopiesAllocV2 const& o) : count(o.count + 1) {} -}; - -int main(int, char**) { - { - using T = CountCopies; - using U = CountCopiesAllocV1; - using P = std::pair<T, U>; - - std::tuple<T> t1; - std::tuple<U> t2; - - TestHarness<P> h; - h.construct(std::piecewise_construct, t1, t2); - P const& p = *h.ptr; - assert(p.first.count == 2); - assert(p.second.count == 2); - assert(p.second.alloc == h.M); - } - { - using T = CountCopiesAllocV1; - using U = CountCopiesAllocV2; - using P = std::pair<T, U>; - - std::tuple<T> t1; - std::tuple<U> t2; - - TestHarness<P> h; - h.construct(std::piecewise_construct, std::move(t1), std::move(t2)); - P const& p = *h.ptr; - assert(p.first.count == 2); - assert(p.first.alloc == h.M); - assert(p.second.count == 2); - assert(p.second.alloc == h.M); - } - { - using T = CountCopiesAllocV2; - using U = CountCopiesAllocV1; - using P = std::pair<T, U>; - - std::tuple<T> t1; - std::tuple<U> t2; - - TestHarness<P> h; - h.construct(std::piecewise_construct, std::move(t1), std::move(t2)); - P const& p = *h.ptr; - assert(p.first.count == 2); - assert(p.first.alloc == h.M); - assert(p.second.count == 2); - assert(p.second.alloc == h.M); - } - { - using T = CountCopiesAllocV2; - using U = CountCopies; - using P = std::pair<T, U>; - - std::tuple<T> t1; - std::tuple<U> t2; - - TestHarness<P> h; - h.construct(std::piecewise_construct, t1, t2); - P const& p = *h.ptr; - assert(p.first.count == 2); - assert(p.first.alloc == h.M); - assert(p.second.count == 2); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_underaligned_buffer.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_underaligned_buffer.pass.cpp deleted file mode 100644 index a01cdce..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_underaligned_buffer.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed -// UNSUPPORTED: availability-pmr-missing - -// <memory_resource> - -// class monotonic_buffer_resource - -#include <cassert> -#include <memory_resource> - -#include "count_new.h" -#include "test_macros.h" - -int main(int, char**) { - globalMemCounter.reset(); - { - alignas(4) char buffer[17]; - auto mono1 = std::pmr::monotonic_buffer_resource(buffer, 16, std::pmr::new_delete_resource()); - std::pmr::memory_resource& r1 = mono1; - - void* ret = r1.allocate(1, 1); - assert(ret == buffer + 15); - mono1.release(); - - ret = r1.allocate(1, 2); - assert(ret == buffer + 14); - mono1.release(); - - ret = r1.allocate(1, 4); - assert(ret == buffer + 12); - mono1.release(); - - // Test a size that is just big enough to fit in the buffer, - // but can't fit if it's aligned. - { - auto mono2 = std::pmr::monotonic_buffer_resource(buffer + 1, 16, std::pmr::new_delete_resource()); - std::pmr::memory_resource& r2 = mono2; - ret = r2.allocate(16, 1); - assert(ret == buffer + 1); - mono2.release(); - - assert(globalMemCounter.checkNewCalledEq(0)); - ret = r2.allocate(16, 2); - ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkNewCalledEq(1)); - ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkLastNewSizeGe(16)); - mono2.release(); - ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkDeleteCalledEq(1)); - } - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp deleted file mode 100644 index 29e9d03..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed -// UNSUPPORTED: availability-pmr-missing - -// <memory_resource> - -// class monotonic_buffer_resource - -#include <memory_resource> -#include <cassert> - -#include "count_new.h" - -int main(int, char**) { - globalMemCounter.reset(); - std::pmr::monotonic_buffer_resource mono; - - for (int i = 0; i < 100; ++i) { - (void)mono.allocate(1); - assert(globalMemCounter.last_new_size < 1000000000); - mono.release(); - assert(globalMemCounter.checkOutstandingNewEq(0)); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.pool/unsynchronized_buffer.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.pool/unsynchronized_buffer.pass.cpp deleted file mode 100644 index 3226efc..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/mem.res.pool/unsynchronized_buffer.pass.cpp +++ /dev/null @@ -1,211 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed -// UNSUPPORTED: availability-pmr-missing - -// <memory_resource> - -// struct pool_options -// class unsynchronized_pool_resource -// class synchronized_pool_resource - -#include <memory_resource> -#include <cassert> -#include <cstdint> // SIZE_MAX, UINT32_MAX - -static void assert_options(const std::pmr::pool_options& actual, const std::pmr::pool_options& expected) { - assert(actual.max_blocks_per_chunk == expected.max_blocks_per_chunk); - assert(actual.largest_required_pool_block == expected.largest_required_pool_block); -} - -void test_pool_options(std::pmr::pool_options initial, std::pmr::pool_options expected) { - std::pmr::unsynchronized_pool_resource mr(initial, std::pmr::null_memory_resource()); - assert_options(mr.options(), expected); - - std::pmr::synchronized_pool_resource mr2(initial, std::pmr::null_memory_resource()); - assert_options(mr2.options(), expected); -} - -int main(int, char**) { - test_pool_options({0, 0}, {1048576, 1048576}); - test_pool_options({0, 1}, {1048576, 8}); - test_pool_options({0, 2}, {1048576, 8}); - test_pool_options({0, 4}, {1048576, 8}); - test_pool_options({0, 8}, {1048576, 8}); - test_pool_options({0, 16}, {1048576, 16}); - test_pool_options({0, 32}, {1048576, 32}); - test_pool_options({0, 1024}, {1048576, 1024}); - test_pool_options({0, 1048576}, {1048576, 1048576}); - test_pool_options({0, 2097152}, {1048576, 2097152}); - test_pool_options({0, 1073741824}, {1048576, 1073741824}); - test_pool_options({0, 2147483648}, {1048576, 1073741824}); - test_pool_options({1, 0}, {16, 1048576}); - test_pool_options({1, 1}, {16, 8}); - test_pool_options({1, 2}, {16, 8}); - test_pool_options({1, 4}, {16, 8}); - test_pool_options({1, 8}, {16, 8}); - test_pool_options({1, 16}, {16, 16}); - test_pool_options({1, 32}, {16, 32}); - test_pool_options({1, 1024}, {16, 1024}); - test_pool_options({1, 1048576}, {16, 1048576}); - test_pool_options({1, 2097152}, {16, 2097152}); - test_pool_options({1, 1073741824}, {16, 1073741824}); - test_pool_options({1, 2147483648}, {16, 1073741824}); - test_pool_options({2, 0}, {16, 1048576}); - test_pool_options({2, 1}, {16, 8}); - test_pool_options({2, 2}, {16, 8}); - test_pool_options({2, 4}, {16, 8}); - test_pool_options({2, 8}, {16, 8}); - test_pool_options({2, 16}, {16, 16}); - test_pool_options({2, 32}, {16, 32}); - test_pool_options({2, 1024}, {16, 1024}); - test_pool_options({2, 1048576}, {16, 1048576}); - test_pool_options({2, 2097152}, {16, 2097152}); - test_pool_options({2, 1073741824}, {16, 1073741824}); - test_pool_options({2, 2147483648}, {16, 1073741824}); - test_pool_options({4, 0}, {16, 1048576}); - test_pool_options({4, 1}, {16, 8}); - test_pool_options({4, 2}, {16, 8}); - test_pool_options({4, 4}, {16, 8}); - test_pool_options({4, 8}, {16, 8}); - test_pool_options({4, 16}, {16, 16}); - test_pool_options({4, 32}, {16, 32}); - test_pool_options({4, 1024}, {16, 1024}); - test_pool_options({4, 1048576}, {16, 1048576}); - test_pool_options({4, 2097152}, {16, 2097152}); - test_pool_options({4, 1073741824}, {16, 1073741824}); - test_pool_options({4, 2147483648}, {16, 1073741824}); - test_pool_options({8, 0}, {16, 1048576}); - test_pool_options({8, 1}, {16, 8}); - test_pool_options({8, 2}, {16, 8}); - test_pool_options({8, 4}, {16, 8}); - test_pool_options({8, 8}, {16, 8}); - test_pool_options({8, 16}, {16, 16}); - test_pool_options({8, 32}, {16, 32}); - test_pool_options({8, 1024}, {16, 1024}); - test_pool_options({8, 1048576}, {16, 1048576}); - test_pool_options({8, 2097152}, {16, 2097152}); - test_pool_options({8, 1073741824}, {16, 1073741824}); - test_pool_options({8, 2147483648}, {16, 1073741824}); - test_pool_options({16, 0}, {16, 1048576}); - test_pool_options({16, 1}, {16, 8}); - test_pool_options({16, 2}, {16, 8}); - test_pool_options({16, 4}, {16, 8}); - test_pool_options({16, 8}, {16, 8}); - test_pool_options({16, 16}, {16, 16}); - test_pool_options({16, 32}, {16, 32}); - test_pool_options({16, 1024}, {16, 1024}); - test_pool_options({16, 1048576}, {16, 1048576}); - test_pool_options({16, 2097152}, {16, 2097152}); - test_pool_options({16, 1073741824}, {16, 1073741824}); - test_pool_options({16, 2147483648}, {16, 1073741824}); - test_pool_options({32, 0}, {32, 1048576}); - test_pool_options({32, 1}, {32, 8}); - test_pool_options({32, 2}, {32, 8}); - test_pool_options({32, 4}, {32, 8}); - test_pool_options({32, 8}, {32, 8}); - test_pool_options({32, 16}, {32, 16}); - test_pool_options({32, 32}, {32, 32}); - test_pool_options({32, 1024}, {32, 1024}); - test_pool_options({32, 1048576}, {32, 1048576}); - test_pool_options({32, 2097152}, {32, 2097152}); - test_pool_options({32, 1073741824}, {32, 1073741824}); - test_pool_options({32, 2147483648}, {32, 1073741824}); - test_pool_options({1024, 0}, {1024, 1048576}); - test_pool_options({1024, 1}, {1024, 8}); - test_pool_options({1024, 2}, {1024, 8}); - test_pool_options({1024, 4}, {1024, 8}); - test_pool_options({1024, 8}, {1024, 8}); - test_pool_options({1024, 16}, {1024, 16}); - test_pool_options({1024, 32}, {1024, 32}); - test_pool_options({1024, 1024}, {1024, 1024}); - test_pool_options({1024, 1048576}, {1024, 1048576}); - test_pool_options({1024, 2097152}, {1024, 2097152}); - test_pool_options({1024, 1073741824}, {1024, 1073741824}); - test_pool_options({1024, 2147483648}, {1024, 1073741824}); - test_pool_options({1048576, 0}, {1048576, 1048576}); - test_pool_options({1048576, 1}, {1048576, 8}); - test_pool_options({1048576, 2}, {1048576, 8}); - test_pool_options({1048576, 4}, {1048576, 8}); - test_pool_options({1048576, 8}, {1048576, 8}); - test_pool_options({1048576, 16}, {1048576, 16}); - test_pool_options({1048576, 32}, {1048576, 32}); - test_pool_options({1048576, 1024}, {1048576, 1024}); - test_pool_options({1048576, 1048576}, {1048576, 1048576}); - test_pool_options({1048576, 2097152}, {1048576, 2097152}); - test_pool_options({1048576, 1073741824}, {1048576, 1073741824}); - test_pool_options({1048576, 2147483648}, {1048576, 1073741824}); - test_pool_options({2097152, 0}, {1048576, 1048576}); - test_pool_options({2097152, 1}, {1048576, 8}); - test_pool_options({2097152, 2}, {1048576, 8}); - test_pool_options({2097152, 4}, {1048576, 8}); - test_pool_options({2097152, 8}, {1048576, 8}); - test_pool_options({2097152, 16}, {1048576, 16}); - test_pool_options({2097152, 32}, {1048576, 32}); - test_pool_options({2097152, 1024}, {1048576, 1024}); - test_pool_options({2097152, 1048576}, {1048576, 1048576}); - test_pool_options({2097152, 2097152}, {1048576, 2097152}); - test_pool_options({2097152, 1073741824}, {1048576, 1073741824}); - test_pool_options({2097152, 2147483648}, {1048576, 1073741824}); - test_pool_options({1073741824, 0}, {1048576, 1048576}); - test_pool_options({1073741824, 1}, {1048576, 8}); - test_pool_options({1073741824, 2}, {1048576, 8}); - test_pool_options({1073741824, 4}, {1048576, 8}); - test_pool_options({1073741824, 8}, {1048576, 8}); - test_pool_options({1073741824, 16}, {1048576, 16}); - test_pool_options({1073741824, 32}, {1048576, 32}); - test_pool_options({1073741824, 1024}, {1048576, 1024}); - test_pool_options({1073741824, 1048576}, {1048576, 1048576}); - test_pool_options({1073741824, 2097152}, {1048576, 2097152}); - test_pool_options({1073741824, 1073741824}, {1048576, 1073741824}); - test_pool_options({1073741824, 2147483648}, {1048576, 1073741824}); - test_pool_options({2147483648, 0}, {1048576, 1048576}); - test_pool_options({2147483648, 1}, {1048576, 8}); - test_pool_options({2147483648, 2}, {1048576, 8}); - test_pool_options({2147483648, 4}, {1048576, 8}); - test_pool_options({2147483648, 8}, {1048576, 8}); - test_pool_options({2147483648, 16}, {1048576, 16}); - test_pool_options({2147483648, 32}, {1048576, 32}); - test_pool_options({2147483648, 1024}, {1048576, 1024}); - test_pool_options({2147483648, 1048576}, {1048576, 1048576}); - test_pool_options({2147483648, 2097152}, {1048576, 2097152}); - test_pool_options({2147483648, 1073741824}, {1048576, 1073741824}); - test_pool_options({2147483648, 2147483648}, {1048576, 1073741824}); - -#if SIZE_MAX > UINT32_MAX - test_pool_options({0, 8589934592}, {1048576, 1073741824}); - test_pool_options({1, 8589934592}, {16, 1073741824}); - test_pool_options({2, 8589934592}, {16, 1073741824}); - test_pool_options({4, 8589934592}, {16, 1073741824}); - test_pool_options({8, 8589934592}, {16, 1073741824}); - test_pool_options({16, 8589934592}, {16, 1073741824}); - test_pool_options({32, 8589934592}, {32, 1073741824}); - test_pool_options({1024, 8589934592}, {1024, 1073741824}); - test_pool_options({1048576, 8589934592}, {1048576, 1073741824}); - test_pool_options({2097152, 8589934592}, {1048576, 1073741824}); - test_pool_options({1073741824, 8589934592}, {1048576, 1073741824}); - test_pool_options({2147483648, 8589934592}, {1048576, 1073741824}); - test_pool_options({8589934592, 0}, {1048576, 1048576}); - test_pool_options({8589934592, 1}, {1048576, 8}); - test_pool_options({8589934592, 2}, {1048576, 8}); - test_pool_options({8589934592, 4}, {1048576, 8}); - test_pool_options({8589934592, 8}, {1048576, 8}); - test_pool_options({8589934592, 16}, {1048576, 16}); - test_pool_options({8589934592, 32}, {1048576, 32}); - test_pool_options({8589934592, 1024}, {1048576, 1024}); - test_pool_options({8589934592, 1048576}, {1048576, 1048576}); - test_pool_options({8589934592, 2097152}, {1048576, 2097152}); - test_pool_options({8589934592, 1073741824}, {1048576, 1073741824}); - test_pool_options({8589934592, 2147483648}, {1048576, 1073741824}); - test_pool_options({8589934592, 8589934592}, {1048576, 1073741824}); -#endif - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/mem.res/pmr.availability.verify.cpp b/libcxx/test/libcxx-03/utilities/utility/mem.res/pmr.availability.verify.cpp deleted file mode 100644 index 34cf178..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/mem.res/pmr.availability.verify.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 -// REQUIRES: availability-pmr-missing - -// TODO: This test doesn't work until https://github.com/llvm/llvm-project/issues/40340 -// has been fixed, because we actually disable availability markup. -// XFAIL: * - -// Test the availability markup on std::pmr components. - -#include <deque> -#include <forward_list> -#include <list> -#include <map> -#include <memory_resource> -#include <regex> -#include <set> -#include <string> -#include <unordered_map> -#include <unordered_set> - -void f() { - [[maybe_unused]] std::pmr::match_results<const char8_t*> m1; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::cmatch m2; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::wcmatch m3; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::smatch m4; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::wsmatch m5; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::deque<int> m6; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::forward_list<int> m7; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::list<int> m8; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::map<int, int> m9; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::multimap<int, int> m10; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::set<int> m11; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::multiset<int> m12; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::string m13; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::wstring m14; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::u8string m15; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::u16string m16; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::u32string m17; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::basic_string<char8_t> m18; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::unordered_map<int, int> m19; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::unordered_multimap<int, int> m20; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::unordered_set<int, int> m21; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::unordered_multiset<int, int> m22; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::vector<int> m23; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::polymorphic_allocator<int> poly; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::memory_resource* res = nullptr; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::synchronized_pool_resource r1; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::monotonic_buffer_resource r2; // expected-error {{is unavailable}} - [[maybe_unused]] std::pmr::unsynchronized_pool_resource r3; // expected-error {{is unavailable}} - (void)std::pmr::get_default_resource(); // expected-error {{is unavailable}} - (void)std::pmr::set_default_resource(nullptr); // expected-error {{is unavailable}} - (void)std::pmr::new_delete_resource(); // expected-error {{is unavailable}} - (void)std::pmr::null_memory_resource(); // expected-error {{is unavailable}} - (void)(*res == *res); // expected-error {{is unavailable}} -} diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/U_V.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/U_V.pass.cpp deleted file mode 100644 index 98363b6..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/U_V.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// template<class U, class V> pair(U&& x, V&& y); - -#include <type_traits> -#include <utility> - -#include "test_macros.h" - - -struct ExplicitT { - constexpr explicit ExplicitT(int x) : value(x) {} - int value; -}; - -struct ImplicitT { - constexpr ImplicitT(int x) : value(x) {} - int value; -}; - -struct ExplicitNothrowT { - explicit ExplicitNothrowT(int x) noexcept : value(x) {} - int value; -}; - -struct ImplicitNothrowT { - ImplicitNothrowT(int x) noexcept : value(x) {} - int value; -}; - -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, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>, int, int>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>, int, int>::value, ""); - } - { // implicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>, int, int>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>, int, int>::value, ""); - 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/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp deleted file mode 100644 index f8dfd9a..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/assign_tuple_like.pass.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// template<class U, class V> pair& operator=(tuple<U, V>&& p); - -#include <utility> -#include <tuple> -#include <array> -#include <memory> -#include <cassert> - -#include "archetypes.h" - -int main(int, char**) -{ - using C = TestTypes::TestType; - { - using P = std::pair<int, C>; - using T = std::tuple<int, C>; - T t(42, C{42}); - P p(101, C{101}); - C::reset_constructors(); - p = t; - assert(C::constructed == 0); - assert(C::assigned == 1); - assert(C::copy_assigned == 1); - assert(C::move_assigned == 0); - assert(p.first == 42); - assert(p.second.value == 42); - } - { - using P = std::pair<int, C>; - using T = std::tuple<int, C>; - T t(42, -42); - P p(101, 101); - C::reset_constructors(); - p = std::move(t); - assert(C::constructed == 0); - assert(C::assigned == 1); - assert(C::copy_assigned == 0); - assert(C::move_assigned == 1); - assert(p.first == 42); - assert(p.second.value == -42); - } - { - using P = std::pair<C, C>; - using T = std::array<C, 2>; - T t = {42, -42}; - P p{101, 101}; - C::reset_constructors(); - p = t; - assert(C::constructed == 0); - assert(C::assigned == 2); - assert(C::copy_assigned == 2); - assert(C::move_assigned == 0); - assert(p.first.value == 42); - assert(p.second.value == -42); - } - { - using P = std::pair<C, C>; - using T = std::array<C, 2>; - T t = {42, -42}; - P p{101, 101}; - C::reset_constructors(); - p = t; - assert(C::constructed == 0); - assert(C::assigned == 2); - assert(C::copy_assigned == 2); - assert(C::move_assigned == 0); - assert(p.first.value == 42); - assert(p.second.value == -42); - } - { - using P = std::pair<C, C>; - using T = std::array<C, 2>; - T t = {42, -42}; - P p{101, 101}; - C::reset_constructors(); - p = std::move(t); - assert(C::constructed == 0); - assert(C::assigned == 2); - assert(C::copy_assigned == 0); - assert(C::move_assigned == 2); - assert(p.first.value == 42); - assert(p.second.value == -42); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp deleted file mode 100644 index c68ed3e..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// pair(const T1& x, const T2& y); - -#include <type_traits> -#include <utility> - -struct ExplicitT { - constexpr explicit ExplicitT(int x) : value(x) {} - constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {} - int value; -}; - -struct ImplicitT { - constexpr ImplicitT(int x) : value(x) {} - constexpr ImplicitT(ImplicitT const& o) : value(o.value) {} - int value; -}; - -struct ExplicitNothrowT { - explicit ExplicitNothrowT(ExplicitNothrowT const&) noexcept {} -}; - -struct ImplicitNothrowT { - ImplicitNothrowT(ImplicitNothrowT const&) noexcept {} -}; - -int main(int, char**) { - { // explicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>, - ExplicitT const&, ExplicitT const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>, - ExplicitNothrowT const&, ExplicitT const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>, - ExplicitT const&, ExplicitNothrowT const&>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>, - ExplicitNothrowT const&, ExplicitNothrowT const&>::value, ""); - } - { // implicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>, - ImplicitT const&, ImplicitT const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>, - ImplicitNothrowT const&, ImplicitT const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>, - ImplicitT const&, ImplicitNothrowT const&>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>, - ImplicitNothrowT const&, ImplicitNothrowT const&>::value, ""); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp deleted file mode 100644 index 497e4f4..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// template <class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p); - -#include <type_traits> -#include <utility> - -#include "test_macros.h" - - -struct ExplicitT { - constexpr explicit ExplicitT(int x) : value(x) {} - constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {} - int value; -}; - -struct ImplicitT { - constexpr ImplicitT(int x) : value(x) {} - constexpr ImplicitT(ImplicitT const& o) : value(o.value) {} - int value; -}; - -struct ExplicitNothrowT { - explicit ExplicitNothrowT(int x) noexcept : value(x) {} - int value; -}; - -struct ImplicitNothrowT { - ImplicitNothrowT(int x) noexcept : value(x) {} - int value; -}; - -int main(int, char**) { - { // explicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>, - std::pair<int, int> const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>, - std::pair<int, int> const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>, - std::pair<int, int> const&>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>, - std::pair<int, int> const&>::value, ""); - } - { // implicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>, - std::pair<int, int> const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>, - std::pair<int, int> const&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>, - std::pair<int, int> const&>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>, - std::pair<int, int> const&>::value, ""); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/default.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/default.pass.cpp deleted file mode 100644 index 3ebf851..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/default.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// constexpr pair(); - -#include <utility> -#include <type_traits> - -#include "test_macros.h" - - -struct ThrowingDefault { - ThrowingDefault() { } -}; - -struct NonThrowingDefault { - NonThrowingDefault() noexcept { } -}; - -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/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp deleted file mode 100644 index 2323851..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// template <class... Args1, class... Args2> -// pair(piecewise_construct_t, tuple<Args1...> first_args, -// tuple<Args2...> second_args); - -#include <tuple> -#include <type_traits> -#include <utility> - -#include "archetypes.h" - -#include "test_macros.h" - - -int main(int, char**) { - using NonThrowingConvert = NonThrowingTypes::ConvertingType; - using ThrowingConvert = NonTrivialTypes::ConvertingType; - static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, ThrowingConvert>, - std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<NonThrowingConvert, ThrowingConvert>, - std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, NonThrowingConvert>, - 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/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp deleted file mode 100644 index 5760284..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// template <class U, class V> pair(pair<U, V>&& p); - -#include <type_traits> -#include <utility> - -#include "test_macros.h" - - -struct ExplicitT { - constexpr explicit ExplicitT(int x) : value(x) {} - int value; -}; - -struct ImplicitT { - constexpr ImplicitT(int x) : value(x) {} - int value; -}; - -struct ExplicitNothrowT { - explicit ExplicitNothrowT(int x) noexcept : value(x) {} - int value; -}; - -struct ImplicitNothrowT { - ImplicitNothrowT(int x) noexcept : value(x) {} - int value; -}; - -int main(int, char**) { - { // explicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>, - std::pair<int, int>&&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>, - std::pair<int, int>&&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>, - std::pair<int, int>&&>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>, - std::pair<int, int>&&>::value, ""); - } - { // implicit noexcept test - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>, - std::pair<int, int>&&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>, - std::pair<int, int>&&>::value, ""); - static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>, - std::pair<int, int>&&>::value, ""); - static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>, - std::pair<int, int>&&>::value, ""); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/utility/small_buffer.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/small_buffer.pass.cpp deleted file mode 100644 index 2214efa..0000000 --- a/libcxx/test/libcxx-03/utilities/utility/small_buffer.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// XFAIL: availability-aligned_allocation-missing - -// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 - -#include "test_macros.h" - -TEST_DIAGNOSTIC_PUSH -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") -#include <__utility/small_buffer.h> -TEST_DIAGNOSTIC_POP - -#include <cassert> -#include <memory> -#include <utility> - -struct NotTriviallyRelocatable { - char c_; - - NotTriviallyRelocatable(char c) : c_(c) {} - ~NotTriviallyRelocatable() {} -}; - -struct alignas(16) Overaligned { - int i; -}; - -int main(int, char**) { - using BufferT = std::__small_buffer<8, 8>; - static_assert(sizeof(BufferT) == 8); - static_assert(alignof(BufferT) == 8); - static_assert(BufferT::__fits_in_buffer<int>); - static_assert(!BufferT::__fits_in_buffer<Overaligned>); - static_assert(!BufferT::__fits_in_buffer<NotTriviallyRelocatable>); - - BufferT buf; - - { // construct/destroy in the same place - buf.__construct<int>(3); - assert(*buf.__get<int>() == 3); - std::destroy_at(buf.__get<int>()); - buf.__dealloc<int>(); - - buf.__construct<NotTriviallyRelocatable>(3); - assert(buf.__get<NotTriviallyRelocatable>()->c_ == 3); - std::destroy_at(buf.__get<NotTriviallyRelocatable>()); - buf.__dealloc<NotTriviallyRelocatable>(); - } - - { // Move the buffer around - buf.__construct<int>(3); - assert(*buf.__get<int>() == 3); - auto buf2 = std::move(buf); - assert(*buf2.__get<int>() == 3); - std::destroy_at(buf2.__get<int>()); - buf2.__dealloc<int>(); - - buf.__construct<NotTriviallyRelocatable>(3); - assert(buf.__get<NotTriviallyRelocatable>()->c_ == 3); - auto buf3 = std::move(buf); - assert(buf3.__get<NotTriviallyRelocatable>()->c_ == 3); - std::destroy_at(buf3.__get<NotTriviallyRelocatable>()); - buf3.__dealloc<NotTriviallyRelocatable>(); - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/variant/no_specializations.verify.cpp b/libcxx/test/libcxx-03/utilities/variant/no_specializations.verify.cpp deleted file mode 100644 index d4743f4..0000000 --- a/libcxx/test/libcxx-03/utilities/variant/no_specializations.verify.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// Check that user-specializations are diagnosed -// See [variant.variant.general]/4 - -#include <variant> - -#if !__has_warning("-Winvalid-specialization") -// expected-no-diagnostics -#else -struct S {}; - -template <> -class std::variant<S>; // expected-error {{cannot be specialized}} -#endif diff --git a/libcxx/test/libcxx-03/utilities/variant/variant.variant/variant.helper/variant_alternative.verify.cpp b/libcxx/test/libcxx-03/utilities/variant/variant.variant/variant.helper/variant_alternative.verify.cpp deleted file mode 100644 index 29f9ace..0000000 --- a/libcxx/test/libcxx-03/utilities/variant/variant.variant/variant.helper/variant_alternative.verify.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// <variant> -// UNSUPPORTED: c++03, c++11, c++14 - - -// template <size_t I, class T> struct variant_alternative; // undefined -// template <size_t I, class T> struct variant_alternative<I, const T>; -// template <size_t I, class T> struct variant_alternative<I, volatile T>; -// template <size_t I, class T> struct variant_alternative<I, const volatile T>; -// template <size_t I, class T> -// using variant_alternative_t = typename variant_alternative<I, T>::type; -// -// template <size_t I, class... Types> -// struct variant_alternative<I, variant<Types...>>; - - -#include <variant> -#include <cassert> - - -int main(int, char**) -{ - { - typedef std::variant<int, double> T; - std::variant_alternative<2, T>::type foo; // expected-note {{requested here}} - // expected-error-re@variant:* {{static assertion failed{{( due to requirement '2U[L]{0,2} < sizeof...\(_Types\)')?}}{{.*}}Index out of bounds in std::variant_alternative<>}} - } - - return 0; -} diff --git a/libcxx/test/libcxx-03/utilities/variant/variant.variant/variant_size.pass.cpp b/libcxx/test/libcxx-03/utilities/variant/variant.variant/variant_size.pass.cpp deleted file mode 100644 index 2f1ea8b..0000000 --- a/libcxx/test/libcxx-03/utilities/variant/variant.variant/variant_size.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11, c++14 - -// <variant> - -// template <class ...Types> class variant; - -#include <limits> -#include <type_traits> -#include <utility> -#include <variant> - -#include "test_macros.h" - -template <class Sequence> -struct make_variant_imp; - -template <std::size_t ...Indices> -struct make_variant_imp<std::integer_sequence<std::size_t, Indices...>> { - template <std::size_t> using AlwaysChar = char; - using type = std::variant<AlwaysChar<Indices>...>; -}; - -template <std::size_t N> -using make_variant_t = typename make_variant_imp<std::make_index_sequence<N>>::type; - -constexpr bool ExpectEqual = -#ifdef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION - false; -#else - true; -#endif - -template <class IndexType> -void test_index_type() { - using Lim = std::numeric_limits<IndexType>; - using T1 = make_variant_t<Lim::max() - 1>; - using T2 = make_variant_t<Lim::max()>; - static_assert((sizeof(T1) == sizeof(T2)) == ExpectEqual, ""); -} - -template <class IndexType> -void test_index_internals() { - using Lim = std::numeric_limits<IndexType>; -#ifdef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION - static_assert(!std::is_same_v<decltype(std::__choose_index_type<Lim::max() - 1>()), - decltype(std::__choose_index_type<Lim::max()>())>); -#endif - static_assert( - std::is_same_v<std::__variant_index_t<Lim::max() - 1>, std::__variant_index_t<Lim::max()> > == ExpectEqual, ""); - using IndexT = std::__variant_index_t<Lim::max() - 1>; - using IndexLim = std::numeric_limits<IndexT>; - static_assert(std::__variant_npos<IndexT> == IndexLim::max(), ""); -} - -template <class LargestType> -struct type_with_index { - LargestType largest; -#ifdef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION - unsigned char index; -#else - unsigned int index; -#endif -}; - -int main(int, char**) { - test_index_type<unsigned char>(); - // This won't compile due to template depth issues. - //test_index_type<unsigned short>(); - test_index_internals<unsigned char>(); - test_index_internals<unsigned short>(); - - // Test that std::variant achieves the expected size. See https://llvm.org/PR61095. - static_assert(sizeof(std::variant<char, char, char>) == sizeof(type_with_index<char>)); - static_assert(sizeof(std::variant<int, int, int>) == sizeof(type_with_index<int>)); - static_assert(sizeof(std::variant<long, long, long>) == sizeof(type_with_index<long>)); - static_assert(sizeof(std::variant<char, int, long>) == sizeof(type_with_index<long>)); - static_assert(sizeof(std::variant<std::size_t, std::size_t, std::size_t>) == sizeof(type_with_index<std::size_t>)); - - return 0; -} |