[ https://issues.apache.org/jira/browse/THRIFT-5200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17113804#comment-17113804 ]
Zezeng Wang commented on THRIFT-5200: ------------------------------------- Is this a bug in jira? I submit a PR and named as "THRIFT-5200: .....", but it doesn't generate the link in this page like other issue. The PR address is: [PR|https://github.com/apache/thrift/pull/2144] > Thrift compiler will generate incorrect code when add 'cob_style' option. > ------------------------------------------------------------------------- > > Key: THRIFT-5200 > URL: https://issues.apache.org/jira/browse/THRIFT-5200 > Project: Thrift > Issue Type: Bug > Components: C++ - Compiler > Reporter: Zezeng Wang > Assignee: Zezeng Wang > Priority: Major > Attachments: StressTest.thrift > > > Step to produce the bug: > 1. Generate 'cob_style' code by command: > thrift -r --gen cpp:cob_style StressTest.thrift > 2.Add main function in Service_async_server.skeleton.cpp file(the default > async file doesn't generate main function): > I just add an simple empty main function to ensure the program has an > entrance: > //generate code ... > int main() > { return 0; } > 3. Compile it by command: > g++ Service_async_server.skeleton.cpp Service.cpp -o asyncServer -lthrift > result: > compile error and output: > Service_async_server.skeleton.cpp:72:19: error: ‘ServiceHandler’ was not > declared in this scope > std::unique_ptr<ServiceHandler> syncHandler_; > ^~~~~~~~~~~~~~ > Service_async_server.skeleton.cpp:72:19: note: suggested alternative: > ‘ServiceAsyncHandler’ > std::unique_ptr<ServiceHandler> syncHandler_; > ^~~~~~~~~~~~~~ > ServiceAsyncHandler > Service_async_server.skeleton.cpp:72:33: error: template argument 1 is > invalid > std::unique_ptr<ServiceHandler> syncHandler_; > ^ > Service_async_server.skeleton.cpp:72:33: error: template argument 2 is > invalid > Service_async_server.skeleton.cpp: In constructor > ‘ServiceAsyncHandler::ServiceAsyncHandler()’: > Service_async_server.skeleton.cpp:19:36: error: ‘ServiceHandler’ was not > declared in this scope > syncHandler_ = std::unique_ptr<ServiceHandler>(new ServiceHandler); > ^~~~~~~~~~~~~~ > Service_async_server.skeleton.cpp:19:36: note: suggested alternative: > ‘ServiceAsyncHandler’ > syncHandler_ = std::unique_ptr<ServiceHandler>(new ServiceHandler); > ^~~~~~~~~~~~~~ > ServiceAsyncHandler > Service_async_server.skeleton.cpp:19:50: error: template argument 1 is > invalid > syncHandler_ = std::unique_ptr<ServiceHandler>(new ServiceHandler); > ^ > Service_async_server.skeleton.cpp:19:50: error: template argument 2 is > invalid > Service_async_server.skeleton.cpp:19:56: error: ‘ServiceHandler’ does not > name a type; did you mean ‘ServiceAsyncHandler’? > syncHandler_ = std::unique_ptr<ServiceHandler>(new ServiceHandler); > ^~~~~~~~~~~~~~ > ServiceAsyncHandler > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoVoid(std::function<void()>)’: > Service_async_server.skeleton.cpp:25:17: error: base operand of ‘->’ is not > a pointer > syncHandler_->echoVoid(); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoByte(std::function<void(const signed char&)>, > int8_t)’: > Service_async_server.skeleton.cpp:31:27: error: base operand of ‘->’ is not > a pointer > _return = syncHandler_->echoByte(arg); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoI32(std::function<void(const int&)>, int32_t)’: > Service_async_server.skeleton.cpp:37:27: error: base operand of ‘->’ is not > a pointer > _return = syncHandler_->echoI32(arg); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoI64(std::function<void(const long int&)>, int64_t)’: > Service_async_server.skeleton.cpp:43:27: error: base operand of ‘->’ is not > a pointer > _return = syncHandler_->echoI64(arg); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoString(std::function<void(const > std::__cxx11::basic_string<char>&)>, const string&)’: > Service_async_server.skeleton.cpp:49:17: error: base operand of ‘->’ is not > a pointer > syncHandler_->echoString(_return, arg); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoList(std::function<void(const std::vector<signed > char>&)>, const std::vector<signed char>&)’: > Service_async_server.skeleton.cpp:55:17: error: base operand of ‘->’ is not > a pointer > syncHandler_->echoList(_return, arg); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoSet(std::function<void(const std::set<signed > char>&)>, const std::set<signed char>&)’: > Service_async_server.skeleton.cpp:61:17: error: base operand of ‘->’ is not > a pointer > syncHandler_->echoSet(_return, arg); > ^~ > Service_async_server.skeleton.cpp: In member function ‘virtual void > ServiceAsyncHandler::echoMap(std::function<void(const std::map<signed char, > signed char>&)>, const std::map<signed char, signed char>&)’: > Service_async_server.skeleton.cpp:67:17: error: base operand of ‘->’ is not > a pointer > syncHandler_->echoMap(_return, arg); > ^~ > expected result: > compile ok and generate an excutable file; -- This message was sent by Atlassian Jira (v8.3.4#803005)