Skip to content

Redundant std::move in json_parsing.cpp #1369

Closed
@PeterUherek

Description

@PeterUherek

I have problem with the compilation of cppreststdk 2.10.15 with gcc 9.3.0. See errror:

/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp: In instantiation of 'std::unique_ptr<web::json::details::_Value> web::json::details::JSON_Parser<CharType>::_ParseValue(web::json::details::JSON_Parser<CharType>::Token&) [with CharType = char]':
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:131:33:   required from 'web::json::value web::json::details::JSON_Parser<CharType>::ParseValue(web::json::details::JSON_Parser<CharType>::Token&) [with CharType = char]'
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1134:39:   required from here
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1077:35: error: redundant move in return statement [-Werror=redundant-move]
 1077 |             return std::move(value);
      |                                   ^
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1077:35: note: remove 'std::move' call
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1089:35: error: redundant move in return statement [-Werror=redundant-move]
 1089 |             return std::move(value);
      |                                   ^
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1089:35: note: remove 'std::move' call
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1096:35: error: redundant move in return statement [-Werror=redundant-move]
 1096 |             return std::move(value);
      |                                   ^
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1096:35: note: remove 'std::move' call
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1103:35: error: redundant move in return statement [-Werror=redundant-move]
 1103 |             return std::move(value);
      |                                   ^
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1103:35: note: remove 'std::move' call
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp: In instantiation of 'std::unique_ptr<web::json::details::_Value> web::json::details::JSON_Parser<CharType>::_ParseArray(web::json::details::JSON_Parser<CharType>::Token&) [with CharType = char]':
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1069:20:   required from 'std::unique_ptr<web::json::details::_Value> web::json::details::JSON_Parser<CharType>::_ParseValue(web::json::details::JSON_Parser<CharType>::Token&) [with CharType = char]'
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:131:33:   required from 'web::json::value web::json::details::JSON_Parser<CharType>::ParseValue(web::json::details::JSON_Parser<CharType>::Token&) [with CharType = char]'
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1134:39:   required from here
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1043:44: error: redundant move in return statement [-Werror=redundant-move]
 1043 |                     return std::move(result);
      |                                            ^
/azure-rest-sdk/cpprestsdk/Release/src/json/json_parsing.cpp:1043:44: note: remove 'std::move' call
[  8%] Building CXX object Release/src/CMakeFiles/cpprest.dir/json/json_serialization.cpp.o
cc1plus: all warnings being treated as errors
make[2]: *** [Release/src/CMakeFiles/cpprest.dir/build.make:206: Release/src/CMakeFiles/cpprest.dir/json/json_parsing.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:115: Release/src/CMakeFiles/cpprest.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Its look like problem on gcc 9.3.0. Can I fix it with disabled warning -DWERROR=0 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions