diff options
-rw-r--r-- | slicer/slicer/modelPartsTypes.cpp | 6 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 1 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.impl.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index 04fc859..e65d721 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -80,6 +80,12 @@ namespace Slicer { throw IncorrectType(name, demangle(target.name())); } + [[noreturn]] void + ModelPartForComplexBase::throwAbstractClassException(const std::type_info & target) + { + throw AbstractClassException(demangle(target.name())); + } + #define Roots(Type, Name, NameLen) \ template<> CONSTSTR(NameLen) Slicer::ModelPartForRoot<Type>::rootName {#Name}; \ template<> \ diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index c81e014..e73b99c 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -148,6 +148,7 @@ namespace Slicer { static const std::string & ToExchangeTypeName(const std::string &); static std::string_view ToModelTypeName(const std::string &); [[noreturn]] static void throwIncorrectType(const std::string & name, const std::type_info & target); + [[noreturn]] static void throwAbstractClassException(const std::type_info & target); }; template<typename T> class Hooks; diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 692437e..b1f0df8 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -429,7 +429,7 @@ namespace Slicer { { BOOST_ASSERT(this->Model); if constexpr (std::is_abstract_v<T>) { - throw AbstractClassException(ModelPartForComplexBase::demangle(typeid(T).name())); + ModelPartForComplexBase::throwAbstractClassException(typeid(T)); } else { *this->Model = std::make_shared<T>(); |