From 85e4598986715233cab31360b5efe3edf25c876c Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Mon, 13 Jan 2020 16:36:32 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20for=20warnings:=20by-copy=20capture=20of?= =?UTF-8?q?=20=E2=80=98this=E2=80=99=20and=20unused-local-typedefs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two warnings when compiling with GCC 7.4.1 or clang 5.0.1. 1. warning: explicit by-copy capture of ‘this’ redundant with by-copy capture default 2. warning: typedef ... locally defined but not used [-Wunused-local-typedefs] This change removes [2] and it compacts the lambda capture clause in [1]. --- include/chaiscript/language/chaiscript_engine.hpp | 4 ++-- include/chaiscript/language/chaiscript_eval.hpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index d7da1257..702d5cbc 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -156,7 +156,7 @@ namespace chaiscript m_engine.add(fun( - [=, this](const dispatch::Proxy_Function_Base &t_fun, const std::vector &t_params) -> Boxed_Value { + [this](const dispatch::Proxy_Function_Base &t_fun, const std::vector &t_params) -> Boxed_Value { Type_Conversions_State s(this->m_engine.conversions(), this->m_engine.conversions().conversion_saves()); return t_fun(Function_Params{t_params}, s); }), "call"); @@ -168,7 +168,7 @@ namespace chaiscript m_engine.add(fun([this](const std::string &t_type_name){ return m_engine.get_type(t_type_name, true); }), "type"); m_engine.add(fun( - [=, this](const Type_Info &t_from, const Type_Info &t_to, const std::function &t_func) { + [this](const Type_Info &t_from, const Type_Info &t_to, const std::function &t_func) { m_engine.add(chaiscript::type_conversion(t_from, t_to, t_func)); } ), "add_type_conversion"); diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 52110bde..d38e5aa3 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -331,7 +331,6 @@ 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))(Function_Params{params}, t_ss.conversions()); }