From e162366b3fb30ebebea12d2484c63069deda10e6 Mon Sep 17 00:00:00 2001 From: vglavnyy <31897320+vglavnyy@users.noreply.github.com> Date: Fri, 19 Jan 2018 02:15:31 +0700 Subject: [PATCH] Removed internal variable with name "data" inside a generated method _nested_root(). Local variable with name "data" violates [-Werror=shadow]. (#4587) --- src/idl_gen_cpp.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 4ae6b7e8e..e497a9bab 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -1645,8 +1645,7 @@ class CppGenerator : public BaseGenerator { code_.SetValue("CPP_NAME", TranslateNameSpace(qualified_name)); code_ += " const {{CPP_NAME}} *{{FIELD_NAME}}_nested_root() const {"; - code_ += " auto data = {{FIELD_NAME}}()->Data();"; - code_ += " return flatbuffers::GetRoot<{{CPP_NAME}}>(data);"; + code_ += " return flatbuffers::GetRoot<{{CPP_NAME}}>({{FIELD_NAME}}()->Data());"; code_ += " }"; }