[SERVER-55017] iassert/tassert evaluate arguments when untriggered Created: 06/Mar/21 Updated: 29/Oct/23 Resolved: 10/Mar/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 4.9.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Sprint: | Service Arch 2021-03-08, Service Arch 2021-03-22 | ||||||||
| Participants: | |||||||||
| Description |
|
The iassert and tassert macros immediately expand all their arguments to a C++ function call expression. The called functions (there are several overloads possible) take nontrivial objects like std::string msg and SourceLocationHolder loc. Another consequence is that the condition is not evaluated in an if condition's bool context, which causes objects with explicit operator bool conversions to be rejected from iassert and uassert where they would not be rejected from the other asserts. An assertion has to be nearly free if the condition passes. |
| Comments |
| Comment by Githook User [ 10/Mar/21 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |
| Comment by Billy Donahue [ 08/Mar/21 ] |
|
Code Review https://mongodbcr.appspot.com/749640009/ |