diff --git a/sol/demangle.hpp b/sol/demangle.hpp
index 78f4dd4..c4538aa 100644
--- a/sol/demangle.hpp
+++ b/sol/demangle.hpp
@@ -25,6 +25,7 @@
 #include <string>
 #include <array>
 #include <cstdlib>
+#include <cassert>
 
 #if defined(__GNUC__) || defined(__clang__)
 #include <cxxabi.h>
@@ -41,6 +42,7 @@ inline std::string get_type_name(const std::type_info& id) {
 inline std::string get_type_name(const std::type_info& id) {
     int status;
     char* unmangled = abi::__cxa_demangle(id.name(), 0, 0, &status);
+    assert(0==status);
     std::string realname = unmangled;
     std::free(unmangled);
     return realname;