Fix warnings from MSVC

This commit is contained in:
Jason Turner 2017-02-22 13:55:02 -07:00
parent f5f6ddf219
commit 40fb8d257e
3 changed files with 18 additions and 7 deletions

View File

@ -588,12 +588,19 @@ namespace chaiscript
template<typename Source, typename Target>
static void check_type()
{
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4127)
#endif
if (sizeof(Source) != sizeof(Target)
|| std::is_signed<Source>() != std::is_signed<Target>()
|| std::is_floating_point<Source>() != std::is_floating_point<Target>())
{
throw chaiscript::detail::exception::bad_any_cast();
}
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif
}
template<typename Target> Target get_as_checked() const

View File

@ -145,9 +145,6 @@ namespace chaiscript
})
, "call_exists");
// m_engine.add(fun<Boxed_Value (const dispatch::Proxy_Function_Base *, const std::vector<Boxed_Value> &)>(std::bind(&chaiscript::dispatch::Proxy_Function_Base::operator(), std::placeholders::_1, std::placeholders::_2, std::ref(m_engine.conversions()))), "call");
//
//
m_engine.add(fun(
[=](const dispatch::Proxy_Function_Base &t_fun, const std::vector<Boxed_Value> &t_params) -> Boxed_Value {

View File

@ -3,6 +3,12 @@
#include "../static_libs/chaiscript_stdlib.hpp"
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4146)
#endif
#define TEST_LITERAL(v) test_literal(v, #v)
#define TEST_LITERAL_SIGNED(v) test_literal(v, #v, true)
@ -269,8 +275,9 @@ int main()
return EXIT_FAILURE;
}
}
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif