[SERVER-23444] Pessimizing moves break compile on clang 3.7+ (expression_tree.h) Created: 31/Mar/16  Updated: 14/Apr/16  Resolved: 31/Mar/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.3.4

Type: Bug Priority: Blocker - P1
Reporter: Scott Hernandez (Inactive) Assignee: Benjamin Murphy
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-20506 Conditionally order $match with $unwind Closed
related to SERVER-21290 remove pessimizing moves Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 12 (04/04/16)
Participants:

 Description   

Since changing src/mongo/db/matcher/expression_tree.h, we now get errors during compilation, on clang 3.7+.

src/mongo/db/matcher/expression_tree.h:71:16: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]



 Comments   
Comment by Githook User [ 31/Mar/16 ]

Author:

{u'username': u'benjaminmurphy', u'name': u'Benjamin Murphy', u'email': u'benjamin_murphy@me.com'}

Message: SERVER-23444 Fixed pessimizing move.
Branch: master
https://github.com/mongodb/mongo/commit/a17c8d9b912965a11b9291b21a1b9e417893de33

Comment by Scott Hernandez (Inactive) [ 31/Mar/16 ]

We can just return the unique_ptr without a std::move.

More reading for clarity: http://stackoverflow.com/questions/25885065/how-can-a-unique-ptr-be-returned-by-value-without-stdmove

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