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.