THRIFT-2513 clean up enum value assignment
Client: Compiler (General)
Patch: Jens Geyer
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 40e7a06..1f7dc64 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -616,19 +616,7 @@
       if ($1 != NULL) {
         $$->set_doc($1);
       }
-      if (g_parse_mode == PROGRAM) {
-        // The scope constants never get deleted, so it's okay for us
-        // to share a single t_const object between our scope and the parent
-        // scope
-        t_const* constant = new t_const(g_type_i32, $2->get_name(),
-                                        new t_const_value($2->get_value()));
-        g_scope->add_constant($2->get_name(), constant);
-        if (g_parent_scope != NULL) {
-          g_parent_scope->add_constant(g_parent_prefix + $2->get_name(),
-                                       constant);
-        }
-      }
-      if ($3 != NULL) {
+	  if ($3 != NULL) {
         $$->annotations_ = $3->annotations_;
         delete $3;
       }
diff --git a/test/EnumTest.thrift b/test/EnumTest.thrift
index e6376f5..deb852f 100644
--- a/test/EnumTest.thrift
+++ b/test/EnumTest.thrift
@@ -36,6 +36,14 @@
   ME2_2,
 }
 
+enum MyEnum2_again {
+  // enum value identifiers may appear again in another enum type
+  ME0_1,
+  ME1_1,
+  ME2_1,
+  ME3_1,
+}
+
 enum MyEnum3 {
   ME3_0,
   ME3_1,