From ec510a0c4b450c1a06fc0f3e114e575a53bfaf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 10 Oct 2015 09:51:47 +0200 Subject: [PATCH] Even more workaround for clang warnings about typeid() side effects. Even after 5aae7c7387caccdb46bf351991e9d1436671704d and d2c1fce24e955d25f2645e827669e67372024135 clang would still emit the warning in code using templates via WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl). Silence the warning by putting the typeid() expressions into a trivial helper function with two wxAnyValueType reference arguments, so the class the macro is used in doesn't come into play (it shouldn't in the previous version of the code either, but clang apparently thought it did). Hopefully really closes #16968. --- include/wx/any.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/wx/any.h b/include/wx/any.h index 8490555be3..2b37bafa5e 100644 --- a/include/wx/any.h +++ b/include/wx/any.h @@ -159,15 +159,17 @@ private: public: \ static bool IsSameClass(const wxAnyValueType* otherType) \ { \ - const wxAnyValueType& inst = *sm_instance.get(); \ - const wxAnyValueType& otherRef = *otherType; \ - return wxTypeId(inst) == wxTypeId(otherRef); \ + return AreSameClasses(*sm_instance.get(), *otherType); \ } \ virtual bool IsSameType(const wxAnyValueType* otherType) const wxOVERRIDE \ { \ 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() \