On Tue, Jul 21, 2026 at 12:11 PM <[email protected]> wrote:

> Hello Damjan, Hi all,
>
>
Hi Peter


> I am integrating Win64 build on bazel.  I am not done yet. But I cam
> across an Issue.
>
> sal: fix std::min type ambiguity in osl/w32 profile.cxx on x64 getLine()
> computes min(pChr - pFile->m_pReadPtr, MaxLen) where the pointer
> difference is ptrdiff_t (64-bit on x64) while MaxLen is int.
>
> When min resolves to std::min -- which it does whenever NOMINMAX is
> defined, suppressing the <windows.h> min/max macros -- the two
> mismatched argument types make template argument deduction ambiguous:
> error C2782: 'const _Ty &std::min(const _Ty &,const _Ty &)' :
> template parameter '_Ty' is ambiguous (could be 'int' or '__int64')
> On x86 both operands are int (ptrdiff_t == int), so it compiled; only
> the x64 pointer-width change exposes it. Disambiguate by casting the
> pointer difference to int (the read buffer is small, so the value always
> fits). The cast is a no-op on x86 and is correct whether min is the
> <windows.h> macro or std::min, so it is safe for every build.
>
> I can Commit in trunk if that makes sense. I did not look deeper into it.
>
>
Yes that makes sense, please cast the first argument to int.



> All the best
>
> Peter
>
>
>
All the best
Damjan

Reply via email to