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.
This commit is contained in:
Jose Rubio 2020-01-13 13:38:04 +01:00
parent 359a7d87c1
commit 3df26129ff
2 changed files with 7 additions and 7 deletions

View File

@ -1303,8 +1303,8 @@ namespace chaiscript
const auto lhssize = lhsparamtypes.size();
const auto rhssize = rhsparamtypes.size();
constexpr auto const boxed_type = user_type<Boxed_Value>();
constexpr auto const boxed_pod_type = user_type<Boxed_Number>();
auto const boxed_type = user_type<Boxed_Value>();
auto const boxed_pod_type = user_type<Boxed_Number>();
for (size_t i = 1; i < lhssize && i < rhssize; ++i)
{

View File

@ -77,7 +77,7 @@ namespace chaiscript
std::vector<Boxed_Value> 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<Dynamic_Object>();
const auto dynamic_object_type_info = user_type<Dynamic_Object>();
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<bool, bool> match(const Function_Params &vals, const Type_Conversions_State &t_conversions) const noexcept
{
constexpr const auto dynamic_object_type_info = user_type<Dynamic_Object>();
const auto dynamic_object_type_info = user_type<Dynamic_Object>();
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<Boxed_Value>();
constexpr const auto boxed_number_ti = user_type<Boxed_Number>();
constexpr const auto function_ti = user_type<std::shared_ptr<const Proxy_Function_Base>>();
const auto boxed_value_ti = user_type<Boxed_Value>();
const auto boxed_number_ti = user_type<Boxed_Number>();
const auto function_ti = user_type<std::shared_ptr<const Proxy_Function_Base>>();
if (ti.is_undef()
|| ti.bare_equal(boxed_value_ti)