From: Konstantin Varlamov Date: Thu, 27 Jul 2023 22:24:15 +0000 (-0700) Subject: [libc++][ranges] Fix `ranges::to` test. X-Git-Tag: upstream/17.0.6~200 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f63cdbcc0cdccf14ac699207be6226b40b1751f8;p=platform%2Fupstream%2Fllvm.git [libc++][ranges] Fix `ranges::to` test. - Make a test for an internal concept libc++-only; - Make sure that `size` and `capacity` in a test container return the same type on all platforms. (cherry picked from commit 8b9a98661b780a5b50d1d6a1f822d25e0c454382) --- diff --git a/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp b/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp index 75f55bc..03270f2 100644 --- a/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp +++ b/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp @@ -19,6 +19,7 @@ #include #include "container.h" #include "test_iterators.h" +#include "test_macros.h" #include "test_range.h" template @@ -119,6 +120,7 @@ struct Fallback { constexpr void push_back(value_type) {} constexpr value_type* begin() { return &x; } constexpr value_type* end() { return &x; } + std::size_t size() const { return 0; } }; struct CtrDirectOrFallback : Fallback { @@ -180,7 +182,7 @@ struct Reservable : Fallback { reserve_called = true; } }; -static_assert(std::ranges::__reservable_container>); +LIBCPP_STATIC_ASSERT(std::ranges::__reservable_container>); constexpr void test_constraints() { { // Case 1 -- construct directly from the range.