Skip to content

Commit 3ff3cf6

Browse files
jll63claude
andauthored
fix: decay decltype(Fn) in method::override for MSVC 19.52 (#149)
MSVC 19.52 (VS 2026, toolset 14.52) gives `decltype(Fn)` the function type, not the pointer type, for a function named without `&` in a `template<auto... Fn>` pack. A single `template<auto Fn>` is unaffected, and so is `&f`; a static member function is affected under /permissive- (hence /std:c++20) but not in C++17 permissive mode. 19.51, gcc and clang give the pointer type. override_aux is only defined for `FnReturnType (*)(FnParameters...)`, so `override<f>` fell back to the undefined primary template: preamble.hpp(1031): error C2079: 'tuple_element<...override_aux< void postfix_minus(...), void (...), false>>::element' uses undefined struct This broke fix_core_overrider_private_base.cpp and fix_core_overrider_virtual.cpp on every MSVC 14.5 CI job. Other tests that register free functions with override<> still compile on 19.52; what spares them is not yet known. Decay the type in override and inline_override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fFU6iQPU1xuk7zqr2XGQx
1 parent 9ad9522 commit 3ff3cf6

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎include/boost/openmethod/core.hpp‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,10 +2800,13 @@ class method<Id, ReturnType(Parameters...), Registry> :
28002800
//! @tparam Fn One or more functions to the overrider list
28012801
template<auto... Fn>
28022802
class override {
2803+
// decay_t: MSVC 19.52 gives `decltype(Fn)` for a free function in an
2804+
// auto parameter pack the function type rather than the pointer type,
2805+
// which does not match override_aux's partial specialization.
28032806
boost::mp11::mp_apply<
28042807
detail::tuple,
2805-
boost::mp11::mp_unique<
2806-
boost::mp11::mp_list<override_aux<Fn, decltype(Fn), false>...>>>
2808+
boost::mp11::mp_unique<boost::mp11::mp_list<
2809+
override_aux<Fn, std::decay_t<decltype(Fn)>, false>...>>>
28072810
impl;
28082811
};
28092812

@@ -2829,10 +2832,11 @@ class method<Id, ReturnType(Parameters...), Registry> :
28292832
// right time.
28302833
template<auto... Fn>
28312834
class inline_override {
2835+
// decay_t: see override.
28322836
boost::mp11::mp_apply<
28332837
detail::tuple,
2834-
boost::mp11::mp_unique<
2835-
boost::mp11::mp_list<override_aux<Fn, decltype(Fn), true>...>>>
2838+
boost::mp11::mp_unique<boost::mp11::mp_list<
2839+
override_aux<Fn, std::decay_t<decltype(Fn)>, true>...>>>
28362840
impl;
28372841
};
28382842

0 commit comments

Comments
 (0)