diff --git a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc index 57641daa36f..b6b90bd3522 100644 --- a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc @@ -1323,7 +1323,7 @@ void t_cpp_generator::generate_struct_declaration(ofstream& out, if (swap) { // Generate a namespace-scope swap() function out << indent() << "void swap(" << tstruct->get_name() << " &a, " << tstruct->get_name() - << " &b) noexcept;" << endl << endl; + << " &b);" << endl << endl; } if (is_user_struct) { @@ -1649,14 +1649,13 @@ void t_cpp_generator::generate_struct_result_writer(ofstream& out, */ void t_cpp_generator::generate_struct_swap(ofstream& out, t_struct* tstruct) { out << indent() << "void swap(" << tstruct->get_name() << " &a, " << tstruct->get_name() - << " &b) noexcept {" << endl; + << " &b) {" << endl; indent_up(); // Let argument-dependent name lookup find the correct swap() function to // use based on the argument types. If none is found in the arguments' // namespaces, fall back to ::std::swap(). out << indent() << "using ::std::swap;" << endl; - out << indent() << "static_assert(noexcept(swap(a, b)), \"throwing swap\");" << endl; bool has_nonrequired_fields = false; const vector& fields = tstruct->get_members(); diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.h b/lib/cpp/src/thrift/transport/THeaderTransport.h index bf826741d75..154f1534b05 100644 --- a/lib/cpp/src/thrift/transport/THeaderTransport.h +++ b/lib/cpp/src/thrift/transport/THeaderTransport.h @@ -69,7 +69,7 @@ class THeaderTransport : public TVirtualTransport& transport) - : TVirtualTransport(transport), + : TVirtualTransport(transport), outTransport_(transport), protoId(T_COMPACT_PROTOCOL), clientType(THRIFT_HEADER_CLIENT_TYPE), @@ -83,7 +83,7 @@ class THeaderTransport : public TVirtualTransport inTransport, const boost::shared_ptr outTransport) - : TVirtualTransport(inTransport), + : TVirtualTransport(inTransport), outTransport_(outTransport), protoId(T_COMPACT_PROTOCOL), clientType(THRIFT_HEADER_CLIENT_TYPE),