diff --git a/include/chaiscript/dispatchkit/bad_boxed_cast.hpp b/include/chaiscript/dispatchkit/bad_boxed_cast.hpp index ca2071b..7afc6dc 100644 --- a/include/chaiscript/dispatchkit/bad_boxed_cast.hpp +++ b/include/chaiscript/dispatchkit/bad_boxed_cast.hpp @@ -46,7 +46,7 @@ namespace chaiscript } bad_boxed_cast(const bad_boxed_cast &) = default; - virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT = default; + virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT {} /// \brief Description of what error occurred virtual const char * what() const CHAISCRIPT_NOEXCEPT CHAISCRIPT_OVERRIDE diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index 61d9d47..78b4dee 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -224,7 +224,7 @@ namespace chaiscript { } - virtual ~Dynamic_Proxy_Function() = default; + virtual ~Dynamic_Proxy_Function() {} virtual bool operator==(const Proxy_Function_Base &rhs) const CHAISCRIPT_OVERRIDE { @@ -591,7 +591,7 @@ namespace chaiscript } dispatch_error(const dispatch_error &) = default; - virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT = default; + virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT {} std::vector parameters; std::vector functions; diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index 6fd9a17..d4cf429 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -46,7 +46,7 @@ namespace chaiscript bad_boxed_dynamic_cast(const bad_boxed_dynamic_cast &) = default; - virtual ~bad_boxed_dynamic_cast() CHAISCRIPT_NOEXCEPT = default; + virtual ~bad_boxed_dynamic_cast() CHAISCRIPT_NOEXCEPT {} }; class bad_boxed_type_cast : public bad_boxed_cast @@ -70,7 +70,7 @@ namespace chaiscript bad_boxed_type_cast(const bad_boxed_type_cast &) = default; - virtual ~bad_boxed_type_cast() CHAISCRIPT_NOEXCEPT = default; + virtual ~bad_boxed_type_cast() CHAISCRIPT_NOEXCEPT {} }; } diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index fb1d213..7a6d010 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -398,7 +398,7 @@ namespace chaiscript { } file_not_found_error(const file_not_found_error &) = default; - virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT = default; + virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT {} }; } diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index 6478c59..a4d354e 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -62,7 +62,7 @@ namespace chaiscript } load_module_error(const load_module_error &) = default; - virtual ~load_module_error() CHAISCRIPT_NOEXCEPT = default; + virtual ~load_module_error() CHAISCRIPT_NOEXCEPT {} }; } diff --git a/src/test_module.cpp b/src/test_module.cpp index aeb1159..2544d53 100644 --- a/src/test_module.cpp +++ b/src/test_module.cpp @@ -9,7 +9,7 @@ class TestBaseType public: TestBaseType() : val(10), const_val(15) { } TestBaseType(int) : val(10), const_val(15) {} - TestBaseType(int *) : val(10), const_val(15) {} + TestBaseType(int *i) : val(10), const_val(15) { } TestBaseType(const TestBaseType &) = default; virtual ~TestBaseType() {} virtual int func() { return 0; } @@ -100,9 +100,11 @@ std::string hello_world() return "Hello World"; } +int global_i = 1; + int *get_new_int() { - return new int(1); + return &global_i; } // MSVC doesn't like that we are using C++ return types from our C declared module diff --git a/unittests/boxed_cast_test.cpp b/unittests/boxed_cast_test.cpp index 4e94471..4635841 100644 --- a/unittests/boxed_cast_test.cpp +++ b/unittests/boxed_cast_test.cpp @@ -265,20 +265,25 @@ bool pointer_test(const T& default_value, const T& new_value) if (p != (*result) ) { std::cerr << "Pointer passed in different than one returned\n"; + delete p; return false; } if (*p != *(*result) ) { std::cerr << "Somehow dereferenced pointer values are not the same?\n"; + delete p; return false; } + delete p; return true; } catch (const exception::bad_boxed_cast &) { std::cerr << "Bad boxed cast performing ** to ** test\n"; + delete p; return false; } catch (...) { std::cerr << "Unknown exception performing ** to ** test\n"; + delete p; return false; }