_makeCoefficientLow in decimal128.h should be static

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • ALL
    • v4.2, v4.0
    • Security 2019-11-04
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Clang 9 emits the following error:

      src/mongo/platform/decimal128_test.cpp:117:26: error: constexpr variable 'expected' must be initialized by a constant expression
      constexpr Decimal128 expected(10);
      ^~~~~~~~~~~~
      src/mongo/platform/decimal128.h:179:55: note: member call on object outside its lifetime is not allowed in a constant expression
      : Decimal128(v < 0 ? 1 : 0, kExponentBias, 0, _makeCoefficientLow(v)) {}
      ^
      src/mongo/platform/decimal128_test.cpp:117:26: note: in call to 'Decimal128(10)'
      constexpr Decimal128 expected(10);

            Assignee:
            Spencer Jackson
            Reporter:
            Spencer Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: