From 788e9d7faa1ad5cc47cc87981af1620f783ec293 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Sun, 16 Jun 2024 16:31:46 +0300 Subject: [PATCH] Fix building qcompare code in MSVC in C++20 mode MSVC quite incorrectly errors out saying that weak_ordering's conversion to partial_ordering cannot access the private constructor that takes the internal order. The problem goes away when the types are forward-declared before they are declared as friends. Fixes: QTBUG-126386 Change-Id: I50ad6d08ee648eb15109dde4a9ec9c753ee18e68 Pick-to: 6.7 Reviewed-by: Giuseppe D'Angelo (cherry picked from commit d2b4aec865bd834747cd824658e567b83bf081e6) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qcompare.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/global/qcompare.h b/src/corelib/global/qcompare.h index 9dd244c8f92..fb5a40f0529 100644 --- a/src/corelib/global/qcompare.h +++ b/src/corelib/global/qcompare.h @@ -62,6 +62,9 @@ constexpr O reversed(O o) noexcept namespace Qt { +class weak_ordering; +class strong_ordering; + class partial_ordering { public: