Disable constinit for MSVC compilers
https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069 does not only affect constinit thread_local but also constinit in general on MSVC compilers when C++20 is being used. So disable the feature for these compilers in general for now. This commit amends d9531593a248e19f7da7862b2870a6af2f413e75 Fixes: QTBUG-105234 Pick-to: 6.4 Change-Id: I1855f0857d85487895460fc7c56675fb864bfa73 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
870cfa4e17
commit
51acd47082
@ -895,10 +895,11 @@ constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cpp_constinit
|
#ifdef __cpp_constinit
|
||||||
# define Q_CONSTINIT constinit
|
|
||||||
# if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
|
# if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
|
||||||
// https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069
|
// https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069
|
||||||
# define Q_THREAD_LOCAL_CONSTINIT
|
# define Q_CONSTINIT
|
||||||
|
# else
|
||||||
|
# define Q_CONSTINIT constinit
|
||||||
# endif
|
# endif
|
||||||
#elif defined(__has_cpp_attribute) && __has_cpp_attribute(clang::require_constant_initialization)
|
#elif defined(__has_cpp_attribute) && __has_cpp_attribute(clang::require_constant_initialization)
|
||||||
# define Q_CONSTINIT [[clang::require_constant_initialization]]
|
# define Q_CONSTINIT [[clang::require_constant_initialization]]
|
||||||
@ -908,10 +909,6 @@ constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
|
|||||||
# define Q_CONSTINIT
|
# define Q_CONSTINIT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_THREAD_LOCAL_CONSTINIT
|
|
||||||
# define Q_THREAD_LOCAL_CONSTINIT Q_CONSTINIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename T> inline T *qGetPtrHelper(T *ptr) noexcept { return ptr; }
|
template <typename T> inline T *qGetPtrHelper(T *ptr) noexcept { return ptr; }
|
||||||
template <typename Ptr> inline auto qGetPtrHelper(Ptr &ptr) noexcept -> decltype(ptr.get())
|
template <typename Ptr> inline auto qGetPtrHelper(Ptr &ptr) noexcept -> decltype(ptr.get())
|
||||||
{ static_assert(noexcept(ptr.get()), "Smart d pointers for Q_DECLARE_PRIVATE must have noexcept get()"); return ptr.get(); }
|
{ static_assert(noexcept(ptr.get()), "Smart d pointers for Q_DECLARE_PRIVATE must have noexcept get()"); return ptr.get(); }
|
||||||
|
@ -2415,7 +2415,7 @@ public:
|
|||||||
{ return std::find(locations.begin(), locations.end(), method) != locations.end(); }
|
{ return std::find(locations.begin(), locations.end(), method) != locations.end(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_THREAD_LOCAL_CONSTINIT static thread_local FlaggedDebugSignatures flaggedSignatures = {};
|
Q_CONSTINIT static thread_local FlaggedDebugSignatures flaggedSignatures = {};
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
const char *qFlagLocation(const char *method)
|
const char *qFlagLocation(const char *method)
|
||||||
|
@ -164,7 +164,7 @@ struct QPropertyDelayedNotifications
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_THREAD_LOCAL_CONSTINIT static thread_local QBindingStatus bindingStatus;
|
Q_CONSTINIT static thread_local QBindingStatus bindingStatus;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 6.2
|
\since 6.2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user