Index: include/typeinfo =================================================================== --- include/typeinfo +++ include/typeinfo @@ -66,6 +66,8 @@ #pragma GCC system_header #endif +#ifndef _LIBCPP_MSVC + namespace std // purposefully not using versioning namespace { @@ -145,6 +147,39 @@ #endif }; +#else + +class _LIBCPP_EXCEPTION_ABI type_info +{ + type_info& operator=(const type_info&); + type_info(const type_info&); +protected: + void *__unused; + char __type_name[1]; + +public: + virtual ~type_info(); + + _LIBCPP_INLINE_VISIBILITY + const char* name() const _NOEXCEPT + {return __type_name;} + + bool before(const type_info& __arg) const _NOEXCEPT; + + size_t hash_code() const _NOEXCEPT; + + bool operator==(const type_info& __arg) const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY + bool operator!=(const type_info& __arg) const _NOEXCEPT + {return !operator==(__arg);} +}; + +namespace std // purposefully not using versioning namespace +{ + using ::type_info; + +#endif // !_LIBCPP_MSVC + class _LIBCPP_EXCEPTION_ABI bad_cast : public exception { Index: src/typeinfo.cpp =================================================================== --- src/typeinfo.cpp +++ src/typeinfo.cpp @@ -20,6 +20,33 @@ #include "typeinfo" +#ifdef _LIBCPP_MSVC + +#include // for __do_string_hash +#include + +bool type_info::before(const type_info& __arg) const _NOEXCEPT +{ + return strcmp(__type_name, __arg.__type_name) < 0; +} + +size_t type_info::hash_code() const _NOEXCEPT +{ + return std::__do_string_hash(__type_name, __type_name + strlen(__type_name)); +} + +bool type_info::operator==(const type_info& __arg) const _NOEXCEPT +{ + return __type_name == __arg.__type_name || + strcmp(__type_name, __arg.__type_name) == 0; +} + +type_info::~type_info() _NOEXCEPT +{ +} + +#endif // _LIBCPP_MSVC + #if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) std::bad_cast::bad_cast() _NOEXCEPT