Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55017

iassert/tassert evaluate arguments when untriggered

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.9.0
    • None
    • Internal Code
    • None
    • Fully Compatible
    • ALL
    • Service Arch 2021-03-08, Service Arch 2021-03-22

    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.
      (see SERVER-54836).

      An assertion has to be nearly free if the condition passes.

      Attachments

        Activity

          People

            billy.donahue@mongodb.com Billy Donahue
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: