From d3046cbe88c5db3e159076457ae012491c53461e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 2 Nov 2020 13:49:36 +0100 Subject: [PATCH] Do not #define dynamic_cast It's illegal. [macro.names]/2: "A translation unit shall not #define or #undef names lexically identical to keywords" If someone tries to use dynamic_cast in a no-rtti scenario, let's just have the compiler yell at them for that. Change-Id: I70a7b55a93d34c433e874d379acae8b256620f80 Pick-to: 5.15 Reviewed-by: Lars Knoll --- src/corelib/global/qglobal.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5856ddfb01..ae20e3da75 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1175,19 +1175,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); #endif // QT_NO_TRANSLATION -/* - When RTTI is not available, define this macro to force any uses of - dynamic_cast to cause a compile failure. -*/ - -#if defined(QT_NO_DYNAMIC_CAST) && !defined(dynamic_cast) -# define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check) - - template - T qt_dynamic_cast_check(X, T* = nullptr) - { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; } -#endif - #ifdef Q_QDOC // Just for documentation generation