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

MONGO_invariant confuses the MSVC compiler that execution may continue

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.5.9
    • Component/s: Internal Code
    • Labels:
      None
    • ALL

      Compiling this code under MSVC produces the following warning:

      [1/2] CXX build\ninja\mongo\db\ops\write_ops_parsers_test.obj
      e:\workspace\mongo\src\mongo\db\ops\write_ops_parsers_test.cpp(341) : warning C4715: 'mongo::A0xc872fdd4::`anonymous namespace'::MyMockDBClient::call': not all control paths return a value
      

      The warning disappears if the invariant is changed to MONGO_UNREACHABLE, which probably means that the infinite loop in MONGO_invariant
      is confusing the compiler somehow.

            Assignee:
            mira.carey@mongodb.com Mira Carey
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: