diff --git a/include/boost/typeof/msvc/typeof_impl.hpp b/include/boost/typeof/msvc/typeof_impl.hpp index d92c90a..1769181 100644 --- a/include/boost/typeof/msvc/typeof_impl.hpp +++ b/include/boost/typeof/msvc/typeof_impl.hpp @@ -88,7 +88,7 @@ namespace boost }; template - struct msvc_typeof : public msvc_typeof_base + struct msvc_typeof : msvc_typeof_base { template<> struct id2type_impl @@ -98,23 +98,37 @@ namespace boost }; # else template - class msvc_typeof_base + struct msvc_typeof_base { - public: - class id2type; + + struct id2type; }; template - class msvc_typeof : public msvc_typeof_base + struct msvc_typeof : msvc_typeof_base { - public: - class msvc_typeof_base::id2type // This uses nice VC6-VC7 bugfeature + struct msvc_typeof_base::id2type // This uses nice VC6-VC7 bugfeature { - public: typedef T type; }; }; # endif + template + struct msvc_typeid_wrapper { + typedef typename msvc_typeof_base::id2type id2type; + typedef typename id2type::type type; + }; + //Workaround for ETI-bug for VC6 and VC7 + template<> + struct msvc_typeid_wrapper<1> { + typedef msvc_typeid_wrapper<1> type; + }; + //Workaround for ETI-bug for VC7.1 + template<> + struct msvc_typeid_wrapper<4> { + typedef msvc_typeid_wrapper<4> type; + }; + //Tie it all together template struct encode_type @@ -135,7 +149,7 @@ namespace boost } # define BOOST_TYPEOF(expr) \ - boost::type_of::msvc_typeof_base::id2type::type + boost::type_of::msvc_typeid_wrapper::type # define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr)