diff options
-rw-r--r-- | libstdc++-v3/include/std/ranges | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/std/ranges/conv/1.cc | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index be8475c..752a04e 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -9389,6 +9389,8 @@ namespace __detail struct _To { template<typename _Range, typename... _Args> + requires requires { ranges::to<_Cont>(std::declval<_Range>(), + std::declval<_Args>()...); } constexpr auto operator()(_Range&& __r, _Args&&... __args) const { @@ -9431,6 +9433,8 @@ namespace __detail struct _To2 { template<typename _Range, typename... _Args> + requires requires { ranges::to<_Cont>(std::declval<_Range>(), + std::declval<_Args>()...); } constexpr auto operator()(_Range&& __r, _Args&&... __args) const { diff --git a/libstdc++-v3/testsuite/std/ranges/conv/1.cc b/libstdc++-v3/testsuite/std/ranges/conv/1.cc index 6d6a708..09fd515 100644 --- a/libstdc++-v3/testsuite/std/ranges/conv/1.cc +++ b/libstdc++-v3/testsuite/std/ranges/conv/1.cc @@ -448,6 +448,24 @@ test_constexpr() static_assert(x == 6); } +void +test_sfinae() +{ + // PR libstdc++/112802 + [](auto x) { + static_assert(!requires { std::ranges::to<std::vector<int>>()(x); }); + static_assert(!requires { std::ranges::to<std::vector>()(x); }); + }(0); +} + +void +test_composition() +{ + // PR libstdc++/113068 + auto adaptor = std::ranges::to<std::string>() | std::ranges::to<std::string>(); + auto str = adaptor(" "); +} + int main() { test_p1206r7_examples(); @@ -460,4 +478,6 @@ int main() test_lwg3984(); test_nodiscard(); test_constexpr(); + test_sfinae(); + test_composition(); } |