Author: roger
Date: Sat Oct 20 21:18:43 2012
New Revision: 1400518

URL: http://svn.apache.org/viewvc?rev=1400518&view=rev
Log:
THRIFT-1731 error: expected identifier before ';' token
Patch: Martin Vogt

Modified:
    thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc

Modified: thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc
URL: 
http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc?rev=1400518&r1=1400517&r2=1400518&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc (original)
+++ thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc Sat Oct 20 
21:18:43 2012
@@ -1999,7 +1999,10 @@ void t_cpp_generator::generate_service_a
     "using boost::shared_ptr;" << endl <<
     endl;
 
-  if (!ns.empty()) {
+  // the following code would not compile:
+  // using namespace ;
+  // using namespace ::;
+  if ( (!ns.empty()) && (ns.compare(" ::") != 0)) {
     f_skeleton <<
       "using namespace " << string(ns, 0, ns.size()-2) << ";" << endl <<
       endl;
@@ -3739,7 +3742,10 @@ void t_cpp_generator::generate_service_s
     "using boost::shared_ptr;" << endl <<
     endl;
 
-  if (!ns.empty()) {
+  // the following code would not compile:
+  // using namespace ;
+  // using namespace ::;
+  if ( (!ns.empty()) && (ns.compare(" ::") != 0)) {
     f_skeleton <<
       "using namespace " << string(ns, 0, ns.size()-2) << ";" << endl <<
       endl;


Reply via email to