// typeinfo standard header // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #pragma once #ifndef _TYPEINFO_ #define _TYPEINFO_ #include #if _STL_COMPILER_PREPROCESSOR #include #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new #pragma warning(disable : 4275) // non dll-interface class 'X' used as base for dll-interface class 'Y' #include _STD_BEGIN // size in pointers of std::function and std::any (roughly 3 pointers larger than std::string when building debug) constexpr int _Small_object_num_ptrs = 6 + 16 / sizeof(void*); #if !_HAS_EXCEPTIONS class _CRTIMP2_IMPORT bad_cast : public exception { // base of all bad cast exceptions public: bad_cast(const char* _Message = "bad cast") noexcept : exception(_Message) {} ~bad_cast() noexcept override {} protected: void _Doraise() const override { // perform class-specific exception handling _RAISE(*this); } }; class _CRTIMP2_IMPORT bad_typeid : public exception { // base of all bad typeid exceptions public: bad_typeid(const char* _Message = "bad typeid") noexcept : exception(_Message) {} ~bad_typeid() noexcept override {} protected: void _Doraise() const override { // perform class-specific exception handling _RAISE(*this); } }; class _CRTIMP2_IMPORT __non_rtti_object : public bad_typeid { // report a non-RTTI object public: __non_rtti_object(const char* _Message) : bad_typeid(_Message) {} }; #endif // !_HAS_EXCEPTIONS [[noreturn]] inline void _Throw_bad_cast() { _THROW(bad_cast{}); } _STD_END #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma pack(pop) #pragma warning(pop) #endif // _STL_COMPILER_PREPROCESSOR #endif // _TYPEINFO_