Thrift supports arbitrarily typed constants across all languages

Summary: Hot! Now you can defined your maps to strings and other constnats things in your .thrift file, so you can have the same symbols and useful defaults defined in your client as in your server.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664881 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrift.y b/compiler/cpp/src/thrift.y
index 06b71e1..c5db20b 100644
--- a/compiler/cpp/src/thrift.y
+++ b/compiler/cpp/src/thrift.y
@@ -345,8 +345,12 @@
   tok_const FieldType tok_identifier '=' ConstValue CommaOrSemicolonOptional
     {
       pdebug("Const -> tok_const FieldType tok_identifier = ConstValue");
-      $$ = new t_const($2, $3, $5);
-      validate_const_type($$);
+      if (g_parse_mode == PROGRAM) {
+        $$ = new t_const($2, $3, $5);
+        validate_const_type($$);
+      } else {
+        $$ = NULL;
+      }
     }
 
 ConstValue: