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 <lars.knoll@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2020-11-02 13:49:36 +01:00
parent ebfd0b14aa
commit d3046cbe88

View File

@ -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<typename T, typename X>
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