From 3df26129ffbe2bfb8a270a88f42b2d37898eda66 Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Mon, 13 Jan 2020 13:38:04 +0100 Subject: [PATCH] New fix for C2131: expression did not evaluate to a constant. Some subexpresion do not evaluate to a constexpr due to the nature of the object. So instead of a compile time expr they have been changed to const. --- include/chaiscript/dispatchkit/dispatchkit.hpp | 4 ++-- include/chaiscript/dispatchkit/proxy_functions.hpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 9b816167..08414975 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -1303,8 +1303,8 @@ namespace chaiscript const auto lhssize = lhsparamtypes.size(); const auto rhssize = rhsparamtypes.size(); - constexpr auto const boxed_type = user_type(); - constexpr auto const boxed_pod_type = user_type(); + auto const boxed_type = user_type(); + auto const boxed_pod_type = user_type(); for (size_t i = 1; i < lhssize && i < rhssize; ++i) { diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index 23ce6eca..3a4a9293 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -77,7 +77,7 @@ namespace chaiscript std::vector convert(Function_Params t_params, const Type_Conversions_State &t_conversions) const { auto vals = t_params.to_vector(); - constexpr const auto dynamic_object_type_info = user_type(); + const auto dynamic_object_type_info = user_type(); for (size_t i = 0; i < vals.size(); ++i) { const auto &name = m_types[i].first; @@ -117,7 +117,7 @@ namespace chaiscript // second result: needs conversions std::pair match(const Function_Params &vals, const Type_Conversions_State &t_conversions) const noexcept { - constexpr const auto dynamic_object_type_info = user_type(); + const auto dynamic_object_type_info = user_type(); bool needs_conversion = false; if (!m_has_types) { return std::make_pair(true, needs_conversion); } @@ -252,9 +252,9 @@ namespace chaiscript static bool compare_type_to_param(const Type_Info &ti, const Boxed_Value &bv, const Type_Conversions_State &t_conversions) noexcept { - constexpr const auto boxed_value_ti = user_type(); - constexpr const auto boxed_number_ti = user_type(); - constexpr const auto function_ti = user_type>(); + const auto boxed_value_ti = user_type(); + const auto boxed_number_ti = user_type(); + const auto function_ti = user_type>(); if (ti.is_undef() || ti.bare_equal(boxed_value_ti)