diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 9227daf6365..8e9c64fc5b0 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1024,7 +1024,11 @@ #endif #ifndef Q_DECL_EQ_DELETE_X -# if defined(__cpp_deleted_function) && __cpp_deleted_function >= 202403L +// Clang advertises the feature-testing macro but issues a warning +// if one isn't also using C++26, +// https://github.com/llvm/llvm-project/issues/109311 +# if defined(__cpp_deleted_function) && __cpp_deleted_function >= 202403L \ + && (!defined(Q_CC_CLANG_ONLY) || __cplusplus > 202302L) // C++26 # define Q_DECL_EQ_DELETE_X(reason) = delete(reason) # else # define Q_DECL_EQ_DELETE_X(reason) = delete