[libcxx-commits] [PATCH] D141456: [libc++][ranges] Fix incorrect integer type in `view_interface` tests.
Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 11 17:43:28 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG17e6bd8070bb: [libc++][ranges] Fix incorrect integer type in `view_interface` tests. (authored by var-const, committed by varconst <varconsteq at gmail.com>).
Changed prior to commit:
https://reviews.llvm.org/D141456?vs=488070&id=488442#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141456/new/
https://reviews.llvm.org/D141456
Files:
libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
Index: libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
===================================================================
--- libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
+++ libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
@@ -15,6 +15,7 @@
#include <ranges>
#include <cassert>
+#include <utility>
#include "test_macros.h"
#include "test_iterators.h"
@@ -233,17 +234,20 @@
static_assert(!SizeInvocable<NotSizedSentinel>);
static_assert( SizeInvocable<ForwardRange>);
- using SignedSize = std::common_type_t<std::ptrdiff_t, std::make_signed_t<std::size_t>>;
+ // Test the test.
+ static_assert(std::same_as<decltype(std::declval<ForwardIter>() - std::declval<ForwardIter>()), std::ptrdiff_t>);
+ using UnsignedSize = std::make_unsigned_t<std::ptrdiff_t>;
+ using SignedSize = std::common_type_t<std::ptrdiff_t, std::make_signed_t<UnsignedSize>>;
ForwardRange forwardRange;
assert(forwardRange.size() == 8);
assert(static_cast<ForwardRange const&>(forwardRange).size() == 8);
assert(std::ranges::size(forwardRange) == 8);
- static_assert(std::same_as<decltype(std::ranges::size(std::declval<ForwardRange>())), std::size_t>);
+ static_assert(std::same_as<decltype(std::ranges::size(std::declval<ForwardRange>())), UnsignedSize>);
static_assert(std::same_as<decltype(std::ranges::ssize(std::declval<ForwardRange>())), SignedSize>);
assert(std::ranges::size(static_cast<ForwardRange const&>(forwardRange)) == 8);
- static_assert(std::same_as<decltype(std::ranges::size(std::declval<ForwardRange const>())), std::size_t>);
+ static_assert(std::same_as<decltype(std::ranges::size(std::declval<ForwardRange const>())), UnsignedSize>);
static_assert(std::same_as<decltype(std::ranges::ssize(std::declval<ForwardRange const>())), SignedSize>);
SizeIsTen sizeTen;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141456.488442.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230112/3982956b/attachment-0001.bin>
More information about the libcxx-commits
mailing list