diff options
Diffstat (limited to 'deps/v8/src/handles.h')
-rw-r--r-- | deps/v8/src/handles.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/deps/v8/src/handles.h b/deps/v8/src/handles.h index 2c98209a1d..8664a3ff89 100644 --- a/deps/v8/src/handles.h +++ b/deps/v8/src/handles.h @@ -5,6 +5,8 @@ #ifndef V8_HANDLES_H_ #define V8_HANDLES_H_ +#include <type_traits> + #include "include/v8.h" #include "src/base/functional.h" #include "src/base/macros.h" @@ -91,11 +93,10 @@ class Handle final : public HandleBase { public: V8_INLINE explicit Handle(T** location = nullptr) : HandleBase(reinterpret_cast<Object**>(location)) { - Object* a = nullptr; - T* b = nullptr; - a = b; // Fake assignment to enforce type checks. - USE(a); + // Type check: + static_assert(std::is_base_of<Object, T>::value, "static type violation"); } + V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {} V8_INLINE Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {} |