diff --git a/stl/inc/ranges b/stl/inc/ranges index 2f8b62dd7ff..c15b5e448da 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -9691,7 +9691,7 @@ namespace ranges { : _Func(in_place, _STD move(_Func_)), _Inner(_STD move(_Range_)) {} _NODISCARD constexpr _Vw base() const& noexcept(noexcept(_Inner.base())) // strengthened - requires copy_constructible<_Inner_view> + requires copy_constructible<_Vw> { return _Inner.base(); } diff --git a/tests/std/tests/P2321R2_views_adjacent_transform/test.cpp b/tests/std/tests/P2321R2_views_adjacent_transform/test.cpp index f5aa39fc497..aabba6c5a11 100644 --- a/tests/std/tests/P2321R2_views_adjacent_transform/test.cpp +++ b/tests/std/tests/P2321R2_views_adjacent_transform/test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -968,6 +969,23 @@ int main() { test_one<3>(span{}, to_float, span{}); } + { // LWG-3947 Unexpected constraints on adjacent_transform_view::base() + struct weird_span : span, ranges::view_base { + weird_span() = default; + weird_span(const weird_span&) = default; + weird_span(weird_span&) = delete; + + weird_span& operator=(const weird_span&) = default; + }; + STATIC_ASSERT(!copy_constructible); + + using weird_adjacent_transform_view = ranges::adjacent_transform_view; + STATIC_ASSERT(!CanMemberBase); + STATIC_ASSERT(!CanMemberBase); + STATIC_ASSERT(!CanMemberBase); + STATIC_ASSERT(CanMemberBase); + } + STATIC_ASSERT((instantiation_test(), true)); instantiation_test(); }