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

clang-format mishandles constexpr-if

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.1
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.2
    • Sprint:
      Dev Tools 2019-07-29

      Description

      clang-format produces formatting which would seem to indicate it doesn't actually understand constexpr-if expressions as seen in the following output from clang-format as run on evergreen during the `lint` task.

            * Returns the bounds on the smallest and largest possible plaintext for the ciphertext.
            */
           std::pair<size_t, size_t> expectedPlaintextLen() const {
      -        if constexpr (Header::kMode == aesMode::cbc) {
      -            return {getDataSize() - crypto::aesBlockSize, getDataSize()};
      -        } else {
      +        if
      +            constexpr(Header::kMode == aesMode::cbc) {
      +                return {getDataSize() - crypto::aesBlockSize, getDataSize()};
      +            }
      +        else {
                   invariant(Header::kMode == aesMode::gcm);
                   return {getDataSize(), getDataSize()};
               }
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: