QVariant: fix C++20 build with older MSVC 2022

... which claim full C++20 conformance (__cplusplus >= 202002), but
still lack https://wg21.link/P0846.

Fix by extending the existing workaround for lack of P0846 support to
these compilers.

Known to fail: _MSC_VER 1936
Known to pass: _MSC_VER 1939

We might need to check 1938 and 1937, but the workaround should only
show up as an additional get/get_if overload and not disturb normal
operation, so it's not critical to get the boundary version exactly
right.

Amends eb9c8042cfa71f16cda27cdeb052d84a6cc117d7.

Task-number: QTQAINFRA-6204
Change-Id: Ia3e0072d606efb7efd6ce0f75239850c7cd925bb
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit ab06d402dd833cefe9c0d929c13e93068aab96d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-03-21 10:52:47 +01:00 committed by Qt Cherry-pick Bot
parent c03274c5c4
commit fa8199459d

View File

@ -1406,7 +1406,11 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
#endif
#if defined(__cplusplus) && __cplusplus >= 202002L // P0846 doesn't have a feature macro :/
# if !defined(Q_CC_MSVC_ONLY) || Q_CC_MSVC < 1939 // claims C++20 support but lacks P0846
// 1939 is known to work
// 1936 is known to fail
# define QT_COMPILER_HAS_P0846
# endif
#endif
#ifdef QT_COMPILER_HAS_P0846