This patch causes multiple enums with the same name to trigger a parser error.
Patch: Ben Taitelbaum
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@982825
13f79535-47bb-0310-9956-
ffa450edef68
}
void add_constant(std::string name, t_const* constant) {
- constants_[name] = constant;
+ if (constants_.find(name) != constants_.end()) {
+ throw "Enum " + name + " is already defined!";
+ } else {
+ constants_[name] = constant;
+ }
+
}
t_const* get_constant(std::string name) {