From f1810bb9604e3b0761ba52e9ddad2afa4c046dd5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Aug 2026 13:37:04 +0200 Subject: [PATCH] Fix compilation of stream position checks with MSVC CHECK(pubseekoff(...) == int) failed to compile because of an ambiguity due to multiple overloaded operator==()s in MSVC CRT. Add a global operator==() overload matching the actual types to help this compiler to do the right thing. This should be reverted when support for MSVS 2015 is dropped. --- tests/streams/stdstream.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/streams/stdstream.cpp b/tests/streams/stdstream.cpp index d2bd068a9e..2aff98490d 100644 --- a/tests/streams/stdstream.cpp +++ b/tests/streams/stdstream.cpp @@ -51,6 +51,16 @@ protected: } // anonymous namespace +// MSVS 2015 can't compile CHECK()s in this file without this disambiguation. +#ifdef __VISUALC__ + #if __VISUALC__ < 1910 + inline bool operator==(const std::fpos<_Mbstatet> lhs, const int rhs) + { + return static_cast(lhs) == rhs; + } + #endif // MSVS 2015 +#endif // __VISUALC__ + // ========================================================================== // Tests // ==========================================================================