From 41eccd318a64f2365c5815fee2f5edced31f5644 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 22 Oct 2024 11:57:25 +0200 Subject: [PATCH] Enforce the availability of std::byte MS-STL has an opt-out that makes std::byte unavailable. This causes build errors in our headers in case client code opts out, so detect this case and provide a clean(er) error message. Change-Id: Iec0790f4c33eb876a98e2e34afbc9889f42333b5 Reviewed-by: Thiago Macieira (cherry picked from commit 5a3859e0a455d82aea9e7c09b87f0dec91dec4e9) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qtypes.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/global/qtypes.h b/src/corelib/global/qtypes.h index 82de5176c1b..6e168e1f875 100644 --- a/src/corelib/global/qtypes.h +++ b/src/corelib/global/qtypes.h @@ -12,6 +12,9 @@ #ifdef __cplusplus # include +# if defined(_HAS_STD_BYTE) && _HAS_STD_BYTE == 0 +# error "Qt requires std::byte, but _HAS_STD_BYTE has been set to 0" +# endif # include # if defined(__STDCPP_FLOAT16_T__) && __has_include() // P1467 implementation - https://wg21.link/p1467