Skip to content

Commit

Permalink
Fix building qcompare code in MSVC in C++20 mode
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit d2b4aec)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
villevoutilainen authored and Qt Cherry-pick Bot committed Jun 16, 2024
1 parent eb397a2 commit 788e9d7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/corelib/global/qcompare.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ constexpr O reversed(O o) noexcept

namespace Qt {

class weak_ordering;
class strong_ordering;

class partial_ordering
{
public:
Expand Down

0 comments on commit 788e9d7

Please sign in to comment.