From 349c905ffcba08836822b0a2bc9b60bd37d910b9 Mon Sep 17 00:00:00 2001 From: Jan van Dijk Date: Tue, 2 Jun 2015 02:07:39 +0200 Subject: [PATCH] Work around clang warning about side effects inside typeid(). This warning was harmless but very annoying as it was given for each and every inclusion of this header. Closes #16968. (this is a backport of 5aae7c7387caccdb46bf351991e9d1436671704d, d2c1fce24e955d25f2645e827669e67372024135 and ec510a0c4b450c1a06fc0f3e114e575a53bfaf74 from master) --- include/wx/any.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/wx/any.h b/include/wx/any.h index c2cd7a79f4..485a2ab734 100644 --- a/include/wx/any.h +++ b/include/wx/any.h @@ -164,13 +164,17 @@ private: public: \ static bool IsSameClass(const wxAnyValueType* otherType) \ { \ - return wxTypeId(*sm_instance.get()) == wxTypeId(*otherType); \ + return AreSameClasses(*sm_instance.get(), *otherType); \ } \ virtual bool IsSameType(const wxAnyValueType* otherType) const \ { \ return IsSameClass(otherType); \ } \ private: \ + static bool AreSameClasses(const wxAnyValueType& a, const wxAnyValueType& b) \ + { \ + return wxTypeId(a) == wxTypeId(b); \ + } \ static wxAnyValueTypeScopedPtr sm_instance; \ public: \ static wxAnyValueType* GetInstance() \