From: Bryan Duxbury Date: Thu, 12 Aug 2010 01:48:51 +0000 (+0000) Subject: THRIFT-570. Thrift compiler does not error when duplicate method names are present X-Git-Tag: 0.4.0~19 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=34b530f099b4ecbc5537ba904f4a91dfef945147;p=common%2Fthrift.git THRIFT-570. Thrift compiler does not error when duplicate method names are present This patch causes the compiler to throw an exception when duplicate method names are found. Patch: Bruce Simpson git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@984628 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/parse/t_service.h b/compiler/cpp/src/parse/t_service.h index eee2dac1..31e6924a 100644 --- a/compiler/cpp/src/parse/t_service.h +++ b/compiler/cpp/src/parse/t_service.h @@ -44,6 +44,12 @@ class t_service : public t_type { } void add_function(t_function* func) { + std::vector::const_iterator iter; + for (iter = functions_.begin(); iter != functions_.end(); iter++) { + if (func->get_name() == (*iter)->get_name()) { + throw "Function " + func->get_name() + " is already defined"; + } + } functions_.push_back(func); }