From 75601b81cc7f05bb396022cf1da355e5150a2b30 Mon Sep 17 00:00:00 2001 From: cubeleo <41136688+cubeleo@users.noreply.github.com> Date: Fri, 10 Aug 2018 13:41:32 -0700 Subject: [PATCH] Correctly generate identifier for enums. (#4871) This should allow the EnumName* function to work with enums generated using the --scoped-enum flag. --- src/idl_gen_cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index b8f14951c..df4c0ad92 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -991,7 +991,7 @@ class CppGenerator : public BaseGenerator { for (auto it = enum_def.vals.vec.begin(); it != enum_def.vals.vec.end(); ++it) { const auto &ev = **it; - code_ += " case {{ENUM_NAME}}_" + Name(ev) + ": return \"" + + code_ += " case " + GetEnumValUse(enum_def, ev) + ": return \"" + Name(ev) + "\";"; }