btc: disambiguate HexStr overload for MSVC (share_tracker.hpp:551) — last coin for all-5 Windows v0.2.1 - #711
Merged
Merged
Conversation
std::vector<unsigned char> (m_address.m_data) is a viable argument for all three HexStr span overloads (const uint8_t / const char / const std::byte) under MSVC.stricter overload resolution, causing C2668 ambiguous-call on the Windows build (GCC/Clang resolve it). Name the exact parameter type of the intended overload, Span<const uint8_t>, built from the raw byte span. Output is byte-identical to the prior GCC/Clang resolution (same bytes to the same uint8_t-span overload); verified against MakeUCharSpan on a fixture. Mirrors the explicit-span idiom already green on the LTC Windows build.
frstrtr
added a commit
that referenced
this pull request
Jul 16, 2026
MSVC C2668: HexStr(std::vector<unsigned char>) is viable for all three Span overloads (uint8_t/char/std::byte). This is the SAME ambiguity #711 fixed in share_tracker.hpp, at a second call site the block-submit fallback path uses. Feed the exact Span<const uint8_t> the intended overload wants, matching the #711 pattern byte-for-byte. Swept all HexStr call sites reachable from the MSVC btc build: the only other bare-container sites (config_coin prefix, config_pool m_prefix) are std::vector<std::byte>, which match a single overload and are already unambiguous. No third site remains. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
BTC is the only coin missing from the v0.2.1 Windows set. c2pool-btc fails on MSVC:
s->m_addressis aBaseScriptwhosem_dataisstd::vector<unsigned char>. MSVCs stricter overload resolution finds that vector viable for all threeHexStrspan overloads (Span<const uint8_t>,Span<const char>,Span<const std::byte>), so the bareHexStr(s->m_address.m_data)call is ambiguous. GCC/Clang resolve it, so Linux/macOS already build.Fix
Name the exact parameter type of the intended overload —
Span<const uint8_t>built from the raw byte span:Span(btclibs/span.h) is already in scope via strencodings.h — no new include. This is MSVC-only disambiguation; no behavior change on any platform.Output verified byte-identical
Minimal TU under -std=c++20 exercising the exact expression on a fixture:
HexStr(Span<const uint8_t>(data, size))==HexStr(MakeUCharSpan(vec))==deadbeef. rc=0.Same bytes to the same uint8_t-span overload GCC/Clang were already selecting → the miner-id hex string is unchanged.
Mirrors the explicit-span idiom already green on the LTC Windows build (ltc/coin/template_builder.hpp).