Add runtime assertion to check that values passed to Obj_val()
[SXSI/xpathcomp.git] / src / common_stub.hpp
index 3e874b7..45aa0ca 100644 (file)
@@ -14,6 +14,7 @@ extern "C" {
 }
 #include <typeinfo>
 #include <cstdio>
+#include <cassert>
 
 #define NoAlloc
 
@@ -26,6 +27,7 @@ value alloc_custom_(char* name);
 
 template <class X> X& Obj_val(value v)
 {
+  assert(Tag_val(v) == Custom_tag);
   return * (X*) Data_custom_val(v);
 }