Remove explicit move of a QHttpServerResponse temporary

This move causes a warning on macOS 12 (treated as error):

    src/httpserver/qhttpserver.cpp:170:20: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
         response = std::move(afterRequestHandler(std::move(response), request));
                    ^
    src/httpserver/qhttpserver.cpp:170:20: note: remove std::move call here
         response = std::move(afterRequestHandler(std::move(response), request));
                    ^~~~~~~~~~                                                 ~

Note: QHttpServerResponse does not have a copy constructor, so the
move is done anyway.

Change-Id: I9d411895323c2601cb3a1596de488c8d7f40e46b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Ievgenii Meshcheriakov 2022-02-09 16:16:07 +01:00
parent 1b91eb912f
commit 62eda14026
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ void QHttpServer::sendResponse(QHttpServerResponse &&response,
{
Q_D(QHttpServer);
for (auto afterRequestHandler : d->afterRequestHandlers)
response = std::move(afterRequestHandler(std::move(response), request));
response = afterRequestHandler(std::move(response), request);
response.write(makeResponder(request, socket));
}