[orc-rt] Prevent RTTIExtends from being used for errors. (#172250)
Custom error types (ErrorInfoBase subclasses) should use ErrorExtends as of 8f51da369e6. Adding a static_assert allows us to enforce that at compile-time.
This commit is contained in:
parent
5a581acb29
commit
61908c5957
@ -52,8 +52,12 @@
|
||||
#ifndef ORC_RT_RTTI_H
|
||||
#define ORC_RT_RTTI_H
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace orc_rt {
|
||||
|
||||
class ErrorInfoBase;
|
||||
|
||||
template <typename ThisT, typename ParentT> class RTTIExtends;
|
||||
|
||||
/// Base class for the extensible RTTI hierarchy.
|
||||
@ -107,6 +111,10 @@ private:
|
||||
///
|
||||
template <typename ThisT, typename ParentT> class RTTIExtends : public ParentT {
|
||||
public:
|
||||
static_assert(!std::is_base_of_v<ErrorInfoBase, ParentT>,
|
||||
"RTTIExtends should not be used to define orc_rt custom error "
|
||||
"types, use ErrorExtends instead");
|
||||
|
||||
// Inherit constructors and isA methods from ParentT.
|
||||
using ParentT::isA;
|
||||
using ParentT::ParentT;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user