Skip to content

fix: decay decltype(Fn) in method::override for MSVC 19.52 - #149

Merged
jll63 merged 1 commit into
boostorg:developfrom
jll63:fix/msvc-19.52-decltype-auto-pack
Nov 27, 2026
Merged

jll63 merged 1 commit into
boostorg:developfrom
jll63:fix/msvc-19.52-decltype-auto-pack

Conversation

@jll63

@jll63 jll63 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

(Written by Claude Code, on behalf of @jll63.)

The MSVC 14.5 CI jobs (VS 2026 runners, now on toolset 14.52 / cl 19.52.37029) fail with C2079 on the two troubleshooting examples that register a free function through the core API, fix_core_overrider_private_base.cpp and fix_core_overrider_virtual.cpp:

preamble.hpp(1031): error C2079: 'tuple_element<method<...>::override_aux<
  void postfix_minus(...), void (...), false>>::element' uses undefined struct

Cause

MSVC 19.52 gives decltype(Fn) the function type rather than the pointer type for a function named without & in a template<auto... Fn> pack. override_aux is only defined for FnReturnType (*)(FnParameters...), so override<f> lands on the undefined primary template.

Each case compiled in its own translation unit:

19.51 19.52 /std:c++17 19.52 /permissive- or /std:c++20 gcc 13 / clang 22
template<auto Fn>, f pointer pointer pointer pointer
template<auto... Fn>, f pointer function function pointer
template<auto... Fn>, &f pointer pointer pointer pointer
template<auto... Fn>, static member S::g pointer pointer function pointer

This is not limited to the two examples. The CMake job stopped after 66 projects, before any test_*.cpp; the b2 job, which keeps going, failed 144 compiles at C++17 (every test that passes a free function to override<>) and 616 each at C++20 and latest, where /permissive- brings in the static member functions that BOOST_OPENMETHOD_OVERRIDE registers. So on 19.52 at C++20, every overrider fails to compile.

Edit: earlier versions of this description, and the squashed commit message, got three things wrong: that &f is affected (it failed only in a test program where pack<f> had already instantiated the same specialization), that the macros escape because they register static member functions, and that other tests registering free functions still compile on 19.52. The b2 CI log above settles the last two.

Fix

std::decay_t<decltype(Fn)> in method::override and method::inline_override.

Tested

  • MSVC 19.52.37029, CMake + Ninja, Debug, tests and examples: 280/280. With develop's headers, both examples still fail with the CI error.
  • gcc 13, CMake Debug: 280/280; b2 (toolset=gcc): 258 passed, 0 failed.

🤖 Generated with Claude Code

https://claude.ai/code/session_016fFU6iQPU1xuk7zqr2XGQx

MSVC 19.52 (VS 2026, toolset 14.52) gives `decltype(Fn)` the function
type, not the pointer type, when `Fn` is a free function passed through
a `template<auto... Fn>` pack - spelled `f` or `&f` alike. A single
`template<auto Fn>` and static member functions are unaffected, and
19.51, gcc and clang all 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

It broke the troubleshooting examples that register a free function
through the core API (fix_core_overrider_private_base.cpp and
fix_core_overrider_virtual.cpp) on every MSVC 14.5 CI job. The macros
register static member functions, which is why nothing else failed.

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
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://149.openmethod.prtest3.cppalliance.org/libs/openmethod/doc/html/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-11-26 21:41:12 UTC

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.57%. Comparing base (b681217) to head (2debf74).
⚠️ Report is 31 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #149   +/-   ##
========================================
  Coverage    92.56%   92.57%           
========================================
  Files           29       29           
  Lines         2314     2316    +2     
  Branches       699      700    +1     
========================================
+ Hits          2142     2144    +2     
  Misses         111      111           
  Partials        61       61           
Files with missing lines Coverage Δ
include/boost/openmethod/core.hpp 92.18% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ad9522...2debf74. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jll63
jll63 merged commit 3ff3cf6 into boostorg:develop Nov 27, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants