From 3c6f8e62a8cc4fd9e09fdcd07a1104759afe4370 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Wed, 17 Sep 2025 10:40:37 +0800 Subject: [PATCH] Forbid conversion from rvalue of proxy to proxy_view --- include/proxy/v4/proxy.h | 2 +- tests/proxy_view_tests.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index 1fd7aac6..2223027e 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -2135,7 +2135,7 @@ struct view_conversion_dispatch : cast_dispatch_base { } }; template -using view_conversion_overload = proxy_view() noexcept; +using view_conversion_overload = proxy_view() & noexcept; struct weak_conversion_dispatch : cast_dispatch_base { template diff --git a/tests/proxy_view_tests.cpp b/tests/proxy_view_tests.cpp index cb684a53..ca269e62 100644 --- a/tests/proxy_view_tests.cpp +++ b/tests/proxy_view_tests.cpp @@ -38,6 +38,11 @@ static_assert( SupportsToString>())>); static_assert(sizeof(pro::proxy_view) == 3 * sizeof(void*)); +static_assert(std::is_nothrow_convertible_v&, + pro::proxy_view>); +static_assert(!std::is_convertible_v, + pro::proxy_view>); + template using AreEqualOverload = bool(const pro::proxy_indirect_accessor& rhs, double eps) const;