[libcxx-commits] [PATCH] D115422: [libc++][ranges] Add subsumption tests to `[special.mem.concepts]`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 9 10:45:28 PST 2021


var-const updated this revision to Diff 393220.
var-const edited the summary of this revision.
var-const added a comment.

Squash two commits into one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115422/new/

https://reviews.llvm.org/D115422

Files:
  libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
  libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp


Index: libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
+++ libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
@@ -12,6 +12,7 @@
 // template<class R>
 // concept __nothrow_forward_range;
 
+#include <array>
 #include <memory>
 
 #include "test_iterators.h"
@@ -33,3 +34,12 @@
 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)
+  requires true {
+  return true;
+}
+constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_range auto);
+
+constexpr std::array<int, 3> array{};
+static_assert(forward_subsumes_input(array));
Index: libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
+++ libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
@@ -29,3 +29,11 @@
 static_assert(std::ranges::__nothrow_forward_iterator<forward_iterator<int*>>);
 static_assert(std::forward_iterator<ForwardProxyIterator>);
 static_assert(!std::ranges::__nothrow_forward_iterator<ForwardProxyIterator>);
+
+constexpr bool forward_subsumes_input(std::ranges::__nothrow_forward_iterator auto)
+  requires true {
+  return true;
+}
+constexpr bool forward_subsumes_input(std::ranges::__nothrow_input_iterator auto);
+
+static_assert(forward_subsumes_input("foo"));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115422.393220.patch
Type: text/x-patch
Size: 2065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211209/19fb7f0d/attachment-0001.bin>


More information about the libcxx-commits mailing list