Fix building on MSVC in C++17 mode

Closes #403 #396 #395
This commit is contained in:
Jason Turner 2018-01-19 10:26:31 -07:00
parent be8726b41a
commit eb93760f1b
4 changed files with 42 additions and 38 deletions

View File

@ -170,6 +170,10 @@ endif()
if(MSVC) if(MSVC)
add_definitions(/W4 /w14545 /w34242 /w34254 /w34287 /w44263 /w44265 /w44296 /w44311 /w44826 /we4289 /w14546 /w14547 /w14549 /w14555 /w14619 /w14905 /w14906 /w14928) add_definitions(/W4 /w14545 /w34242 /w34254 /w34287 /w44263 /w44265 /w44296 /w44311 /w44826 /we4289 /w14546 /w14547 /w14549 /w14555 /w14619 /w14905 /w14906 /w14928)
if (BUILD_IN_CPP17_MODE)
add_definitions(/std:c++17)
endif()
if (MSVC_VERSION STREQUAL "1800") if (MSVC_VERSION STREQUAL "1800")
# VS2013 doesn't have magic statics # VS2013 doesn't have magic statics
add_definitions(/w44640) add_definitions(/w44640)

View File

@ -170,7 +170,7 @@ namespace chaiscript {
auto parse_num(const char *t_str) -> typename std::enable_if<!std::is_integral<T>::value, T>::type auto parse_num(const char *t_str) -> typename std::enable_if<!std::is_integral<T>::value, T>::type
{ {
T t = 0; T t = 0;
T base; T base{};
T decimal_place = 0; T decimal_place = 0;
int exponent = 0; int exponent = 0;

View File

@ -86,7 +86,7 @@ namespace chaiscript
// only compile this bit if noexcept is part of the type system // only compile this bit if noexcept is part of the type system
// //
#if __cpp_noexcept_function_type >= 201510 #if __cpp_noexcept_function_type >= 201510 || (_MSVC_LANG > 201403L && _MSC_VER >= 1912)
template<typename Ret, typename ... Param> template<typename Ret, typename ... Param>
Proxy_Function fun(Ret (*func)(Param...) noexcept) Proxy_Function fun(Ret (*func)(Param...) noexcept)
{ {

View File

@ -200,7 +200,7 @@ namespace chaiscript
m_engine.add(fun([this](const Boxed_Value &t_bv, const std::string &t_name){ add_global(t_bv, t_name); }), "add_global"); m_engine.add(fun([this](const Boxed_Value &t_bv, const std::string &t_name){ add_global(t_bv, t_name); }), "add_global");
m_engine.add(fun([this](const Boxed_Value &t_bv, const std::string &t_name){ set_global(t_bv, t_name); }), "set_global"); m_engine.add(fun([this](const Boxed_Value &t_bv, const std::string &t_name){ set_global(t_bv, t_name); }), "set_global");
m_engine.add(fun([this](const std::string& t_namespace_name) { register_namespace([](Namespace& space) {}, t_namespace_name); import(t_namespace_name); }), "namespace"); m_engine.add(fun([this](const std::string& t_namespace_name) { register_namespace([](Namespace& /*space*/) {}, t_namespace_name); import(t_namespace_name); }), "namespace");
m_engine.add(fun([this](const std::string& t_namespace_name) { import(t_namespace_name); }), "import"); m_engine.add(fun([this](const std::string& t_namespace_name) { import(t_namespace_name); }), "import");
} }