Skip to content

error: building with Xcode 12 yields failures from -Wrange-loop-analysis #13139

@rebello95

Description

@rebello95

Title: error: building with Xcode 12 yields failures from -Wrange-loop-analysis

Related issues:

This is actually the same error flagged in #11949. Flagging because it's consistently reproducible on Xcode 12.

Description:

When building Envoy Mobile with Xcode 12, builds fail with the following error:

--
  | external/envoy/source/common/common/utility.cc:312:21: error: loop variable 'token' of type 'const std::__1::basic_string_view<char, std::__1::char_traits<char> >' creates a copy from type 'const std::__1::basic_string_view<char, std::__1::char_traits<char> >' [-Werror,-Wrange-loop-analysis]
  | for (const auto token : tokens) {
  | ^
  | external/envoy/source/common/common/utility.cc:312:10: note: use reference type 'const std::__1::basic_string_view<char, std::__1::char_traits<char> > &' to prevent copying
  | for (const auto token : tokens) {
  | ^~~~~~~~~~~~~~~~~~
  | &
  | 1 error generated.

Repro steps:

With the following environment:

  • macOS 10.15.6 (19G2021)
  • Xcode 12.0 GM 2 (12A7209)

Attempt to build Envoy Mobile at eb95c50c1edb672916f9c07db30333c6624377b6:

bazelisk build ios_dist --config=release-ios --ios_multi_cpus=x86_64,arm64 --features=-swift.no_generated_header

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions