diff --git a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc index 69842689296..cb8a8be7d54 100644 --- a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc @@ -271,9 +271,12 @@ class t_cpp_generator : public t_oop_generator { bool is_complex_type(t_type* ttype) { ttype = get_true_type(ttype); - return ttype->is_container() || ttype->is_struct() || ttype->is_xception() + return ttype->is_container() // + || ttype->is_struct() // + || ttype->is_xception() || (ttype->is_base_type() - && (((t_base_type*)ttype)->get_base() == t_base_type::TYPE_STRING)); + && ((((t_base_type*)ttype)->get_base() == t_base_type::TYPE_STRING) + || (((t_base_type*)ttype)->get_base() == t_base_type::TYPE_UUID))); } void set_use_include_prefix(bool use_include_prefix) { use_include_prefix_ = use_include_prefix; } @@ -4485,7 +4488,7 @@ string t_cpp_generator::type_name(t_type* ttype, bool in_typedef, bool arg) { return bname; } - if (((t_base_type*)ttype)->get_base() == t_base_type::TYPE_STRING) { + if ((((t_base_type*)ttype)->get_base() == t_base_type::TYPE_STRING) || ((((t_base_type*)ttype)->get_base() == t_base_type::TYPE_UUID))) { return "const " + bname + "&"; } else { return "const " + bname; diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp index 513f0712b52..745feb786c0 100644 --- a/lib/c_glib/test/testthrifttestclient.cpp +++ b/lib/c_glib/test/testthrifttestclient.cpp @@ -112,9 +112,9 @@ class TestHandler : public ThriftTestIf { out = thing; } - apache::thrift::TUuid testUuid(const apache::thrift::TUuid thing) override { + void testUuid(apache::thrift::TUuid& out, const apache::thrift::TUuid& thing) override { cout << "[C -> C++] testUuid(\"" << thing << "\")" << '\n'; - return thing; + out = thing; } void testStruct(Xtruct& out, const Xtruct &thing) override { diff --git a/lib/c_glib/test/testthrifttestzlibclient.cpp b/lib/c_glib/test/testthrifttestzlibclient.cpp index dbcd64e76a6..783d06550a2 100644 --- a/lib/c_glib/test/testthrifttestzlibclient.cpp +++ b/lib/c_glib/test/testthrifttestzlibclient.cpp @@ -107,9 +107,9 @@ class TestHandler : public ThriftTestIf { out = thing; } - apache::thrift::TUuid testUuid(const apache::thrift::TUuid thing) override { + void testUuid(apache::thrift::TUuid& out, const apache::thrift::TUuid& thing) override { cout << "[C -> C++] testUuid(\"" << thing << "\")" << '\n'; - return thing; + out = thing; } void testStruct(Xtruct& out, const Xtruct &thing) override { @@ -297,7 +297,7 @@ class TestHandler : public ThriftTestIf { } void testException(const std::string &arg) - throw(Xception, apache::thrift::TException) override + noexcept(false) override { cout << "[C -> C++] testException(" << arg << ")" << '\n'; if (arg.compare("Xception") == 0) { @@ -315,7 +315,7 @@ class TestHandler : public ThriftTestIf { } } - void testMultiException(Xtruct &result, const std::string &arg0, const std::string &arg1) throw(Xception, Xception2) override { + void testMultiException(Xtruct &result, const std::string &arg0, const std::string &arg1) noexcept(false) override { cout << "[C -> C++] testMultiException(" << arg0 << ", " << arg1 << ")" << '\n'; diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp index 6bda29431ef..64193c657c6 100644 --- a/test/cpp/src/TestClient.cpp +++ b/test/cpp/src/TestClient.cpp @@ -181,7 +181,9 @@ bool print_eq(T expected, T actual) { #define UUID_TEST(func, value, expected) \ cout << #func "(" << value << ") = "; \ try { \ - if (!print_eq(expected, testClient.func(value))) \ + TUuid ret; \ + testClient.func(ret, value); \ + if (!print_eq(expected, ret)) \ return_code |= ERR_BASETYPES; \ } catch (TTransportException&) { \ throw; \ diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp index dc6e69f6f0d..858fffa3852 100644 --- a/test/cpp/src/TestServer.cpp +++ b/test/cpp/src/TestServer.cpp @@ -132,9 +132,9 @@ class TestHandler : public ThriftTestIf { _return = thing; } - TUuid testUuid(const TUuid thing) override { + void testUuid(apache::thrift::TUuid& _return, const apache::thrift::TUuid& thing) override { printf("testUuid(\"{%s}\")\n", to_string(thing).c_str()); - return thing; + _return = thing; } void testStruct(Xtruct& out, const Xtruct& thing) override { @@ -447,8 +447,9 @@ class TestHandlerAsync : public ThriftTestCobSvIf { cob(res); } - void testUuid(::std::function cob, const TUuid thing) override { - TUuid res = _delegate->testUuid(thing); + void testUuid(::std::function cob, const apache::thrift::TUuid& thing) override { + TUuid res; + _delegate->testUuid(res, thing); cob(res); }