From: Thomas Geymayer Date: Fri, 9 May 2014 09:52:42 +0000 (+0200) Subject: SGWeakReferenced: fix for clang. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d34d3ecfb14a610f5bad94010718d72416ea2813;p=simgear.git SGWeakReferenced: fix for clang. --- diff --git a/simgear/structure/SGWeakReferenced.hxx b/simgear/structure/SGWeakReferenced.hxx index 7a2bcaf5..3bb70ffa 100644 --- a/simgear/structure/SGWeakReferenced.hxx +++ b/simgear/structure/SGWeakReferenced.hxx @@ -121,12 +121,7 @@ private: boost::is_base_of, T* >::type - up_cast(SGWeakReferenced* ptr) - { - // First get the virtual base class, which then can be used to further - // upcast. - return dynamic_cast(static_cast(ptr)); - } + up_cast(SGWeakReferenced* ptr); /// Upcast in a non-virtual class hierarchy template @@ -183,6 +178,20 @@ class SGVirtualWeakReferenced: virtual ~SGVirtualWeakReferenced() {} }; +/// Upcast in a class hierarchy with a virtual base class +// We (clang) need the definition of SGVirtualWeakReferenced for the static_cast +template +typename boost::enable_if< + boost::is_base_of, + T* +>::type +SGWeakReferenced::WeakData::up_cast(SGWeakReferenced* ptr) +{ + // First get the virtual base class, which then can be used to further + // upcast. + return dynamic_cast(static_cast(ptr)); +} + #ifdef _MSC_VER # pragma warning(pop) #endif