diff options
author | Derek Bailey <dbaileychess@gmail.com> | 2022-02-24 22:01:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-24 22:01:25 -0800 |
commit | 318594e4b44891ba5675280c59bd8ef2d3441423 (patch) | |
tree | daf04d1a4e44ee34de00fac1ea6f0b206feb6711 /src/idl_gen_cpp.cpp | |
parent | 3d903302c320ba5ea66ca153375a3290d97cfb3e (diff) | |
download | flatbuffers-318594e4b44891ba5675280c59bd8ef2d3441423.tar.gz flatbuffers-318594e4b44891ba5675280c59bd8ef2d3441423.tar.bz2 flatbuffers-318594e4b44891ba5675280c59bd8ef2d3441423.zip |
prevent name clash (#7133)
Diffstat (limited to 'src/idl_gen_cpp.cpp')
-rw-r--r-- | src/idl_gen_cpp.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index bfe2a289..dfd9525c 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -1965,8 +1965,9 @@ class CppGenerator : public BaseGenerator { cw.IncrementIdentLevel(); cw += "{{FIELD}}.reserve(o.{{FIELD}}.size());"; cw += - "for (const auto &v : o.{{FIELD}}) { " - "{{FIELD}}.emplace_back((v) ? new {{TYPE}}(*v) : nullptr); }"; + "for (const auto &{{FIELD}}_ : o.{{FIELD}}) { " + "{{FIELD}}.emplace_back(({{FIELD}}_) ? new {{TYPE}}(*{{FIELD}}_) " + ": nullptr); }"; vector_copies += cw.ToString(); } else { // For non-pointer elements, use std::vector's copy constructor in the |