diff --git a/CMakeLists.txt b/CMakeLists.txt index e98ed1d7..2b210467 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,8 @@ if(MSVC) add_definitions(/std:c++17) endif() + + if (MSVC_VERSION STREQUAL "1800") # VS2013 doesn't have magic statics add_definitions(/w44640) @@ -182,7 +184,7 @@ if(MSVC) add_definitions(/w34062) endif() - add_definitions(/bigobj) + add_definitions(/bigobj /permissive-) # Note on MSVC compiler flags. # The code base selective disables warnings as necessary when the compiler is complaining too much # about something that is perfectly valid, or there is simply no technical way around it diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index e0933b71..e5b2aa7e 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -327,15 +327,17 @@ namespace chaiscript Boxed_Value fn(this->children[0]->eval(t_ss)); + using ConstFunctionTypePtr = const dispatch::Proxy_Function_Base *; try { - return (*t_ss->boxed_cast(fn))(params, t_ss.conversions()); + return (*t_ss->boxed_cast(fn))(params, t_ss.conversions()); } catch(const exception::dispatch_error &e){ throw exception::eval_error(std::string(e.what()) + " with function '" + this->children[0]->text + "'", e.parameters, e.functions, false, *t_ss); } catch(const exception::bad_boxed_cast &){ try { - Const_Proxy_Function f = t_ss->boxed_cast(fn); + using ConstFunctionTypeRef = const Const_Proxy_Function &; + Const_Proxy_Function f = t_ss->boxed_cast(fn); // handle the case where there is only 1 function to try to call and dispatch fails on it throw exception::eval_error("Error calling function '" + this->children[0]->text + "'", params, {f}, false, *t_ss); } catch (const exception::bad_boxed_cast &) {