[CXX-2145] Coverity analysis defect 115920: Missing move assignment operator Created: 14/Dec/20  Updated: 27/Oct/23  Resolved: 24/Jul/23

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: size-small
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: CXX-2632
Quarter: FY24Q2

 Description   

Missing move assignment operator

This class does not have a user-written move assignment operator and its copy assignment operator is found to be applied to rvalue(s), which can be moved to possibly enhance program performance had the move assignment operator been in place. Class lacks a user-written move assignment operator
/src/bsoncxx/types/bson_value/view.hpp:44: MISSING_MOVE_ASSIGNMENT 115920 Class "bsoncxx::v_noabi::types::bson_value::view" may benefit from adding a move assignment operator. See other events which show the copy assignment operator being applied to rvalue(s), where a move assignment may be faster.



 Comments   
Comment by Kevin Albertson [ 24/Jul/23 ]

I expect the default copy constructor is called since no move constructor is called:

Note: When the move constructor is not implicitly declared or explicitly supplied, expressions that otherwise would have invoked the move constructor may instead invoke a copy constructor. — end note

bsoncxx::types::bson_value::view does not own data. I expect calling the copy-constructor on move is OK. Closing as "Works as Designed".

Comment by Coverity Collector User [ 14/Dec/20 ]

A new defect has been detected and assigned to kevin.albertson in Coverity Connect.
http://coverity.mongodb.com/query/defects.htm?project=CXX+master&cid=115920
The defect was flagged by checker MISSING_MOVE_ASSIGNMENT in
file /src/bsoncxx/types/bson_value/view.hpp
function None
and this ticket was created by kevin.albertson

Generated at Wed Feb 07 22:05:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.