[SERVER-38664] dbtest does not compile with clang 7 Created: 15/Dec/18  Updated: 29/Oct/23  Resolved: 17/Dec/18

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.1.7

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2018-12-31
Participants:

 Description   

When building the dbtest binary with clang 7, the following error is emitted:

Compiling build/cached/mongo/dbtests/insert_test.o
src/mongo/dbtests/insert_test.cpp:79:12: error: local variable 'obj' will be copied despite being returned by name
      [-Werror,-Wreturn-std-move]
    return obj;
           ^~~
src/mongo/dbtests/insert_test.cpp:79:12: note: call 'std::move' explicitly to avoid copying
    return obj;
           ^~~
           std::move(obj)
1 error generated.
scons: *** [build/cached/mongo/dbtests/insert_test.o] Error 1
scons: done building targets (errors occurred during build).

The fix is to either change the function to return BSONArray, or to change it to return std::move(obj);. The former change is probably preferred for clarity.



 Comments   
Comment by Githook User [ 17/Dec/18 ]

Author:

{'username': 'acmorrow', 'email': 'acm@mongodb.com', 'name': 'Andrew Morrow'}

Message: SERVER-38664 Use the correct return type to placate clang warning
Branch: master
https://github.com/mongodb/mongo/commit/b42ac5010af447ad1872078415e53bb0a9010655

Generated at Thu Feb 08 04:49:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.