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

add & to fix [-Wrange-loop-analysis] warning (xcode)

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Service Arch 2021-03-22

      PATH='/usr/local/bin:/opt/bin:/bin:/usr/bin' PATHOSX='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ @build/ninja/mongo/db/s/config/sharding_catalog_manager_chunk_operations.o.rsp
      src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp:514:21: error: loop variable 'shard' of type 'const mongo::BSONElement' creates a copy from type 'const mongo::BSONElement' [-Werror,-Wrange-loop-analysis]
          for (const auto shard : valuesElem.Array()) {
                          ^
      src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp:514:10: note: use reference type 'const mongo::BSONElement &' to prevent copying
          for (const auto shard : valuesElem.Array()) {
               ^~~~~~~~~~~~~~~~~~
                          &
      

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

              Created:
              Updated:
              Resolved: