From f71c53226505f441c8ed2646b8d7c7e9dea0b901 Mon Sep 17 00:00:00 2001 From: "Jonathan B. Coe" Date: Fri, 11 Sep 2026 19:16:51 +0100 Subject: [PATCH] Remove EnclosingType from operator_thunk as it is not used --- protocol.hh | 52 +++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/protocol.hh b/protocol.hh index 3c4987be..a1c55189 100644 --- a/protocol.hh +++ b/protocol.hh @@ -402,19 +402,17 @@ struct member_thunk // derives from this thunk directly instead of holding it as a data member, // letting `ProtocolType` be recovered with a plain static_cast. template + typename ProtocolType, typename Vtable, std::meta::info Member, + bool IsConst, bool IsNoexcept> struct operator_thunk; // TODO(jbcoe): Extend this approach to handle lvalue and rvalue qualifiers; // until then `protocol_interface_function_infos` rejects ref-qualified // interface members. -template +template struct operator_thunk { + ProtocolType, Vtable, Member, IsConst, IsNoexcept> { static constexpr std::meta::info vtable_entry = find_vtable_entry<^^Vtable, Member>(); @@ -448,14 +446,13 @@ struct operator_thunk +template struct operator_thunk_for; -template -struct operator_thunk_for, EnclosingType, - ProtocolType, Vtable> { +template +struct operator_thunk_for, ProtocolType, + Vtable> { // Build the function-pointer type R(*)(Args...) from the method's return // type and parameter types. static consteval std::meta::info fn_ptr_type() { @@ -472,7 +469,7 @@ struct operator_thunk_for, EnclosingType, { std::meta::reflect_constant(operator_of(Member)), fn_ptr_type(), - ^^EnclosingType, ^^ProtocolType, ^^Vtable, + ^^ProtocolType, ^^Vtable, std::meta::reflect_constant(Member), std::meta::reflect_constant(IsConst), std::meta::reflect_constant(is_noexcept(Member)) @@ -480,10 +477,9 @@ struct operator_thunk_for, EnclosingType, // clang-format on }; -template +template using operator_thunk_t = - operator_thunk_for::type; + operator_thunk_for::type; // The overload set for a synthesised operator X inheriting from an // `operator_thunk` for each overload. @@ -491,14 +487,8 @@ using operator_thunk_t = // OverloadSpec. template struct operator_overload_set - : operator_thunk_t< - OverloadSpecs, - operator_overload_set, - ProtocolType, Vtable>... { - using operator_thunk_t< - OverloadSpecs, - operator_overload_set, - ProtocolType, Vtable>::operator()...; + : operator_thunk_t... { + using operator_thunk_t::operator()...; }; // How generated wrappers treat the const-qualification of interface members. @@ -959,8 +949,8 @@ class protocol friend struct detail::method_thunk; template + typename ProtocolType, typename Vtable, std::meta::info Member, + bool IsConst, bool IsNoexcept> friend struct detail::operator_thunk; // Grants `protocol_view` access so that a view of a protocol can share its @@ -1275,8 +1265,8 @@ class protocol_view friend struct detail::method_thunk; template + typename ProtocolType, typename Vtable, std::meta::info Member, + bool IsConst, bool IsNoexcept> friend struct detail::operator_thunk; template @@ -1371,8 +1361,8 @@ class protocol_view friend struct detail::method_thunk; template + typename ProtocolType, typename Vtable, std::meta::info Member, + bool IsConst, bool IsNoexcept> friend struct detail::operator_thunk; template