Skip to content

Build error in sync_switch.cc on Clang-16 with GCC 14 stdlib. #150515

@johnoneil

Description

@johnoneil

Steps to reproduce

This is reproducible on certain setups building with Clang++-16 using GCC 14 C++ stdlib backend.

For example:

clang++-16 -v
Debian clang version 16.0.6 (20)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64

Building in this configuration results in error:

/usr/bin/clang++-16 -DIMPELLER_DEBUG=1 -DIMPELLER_ENABLE_3D=1 -I/mnt/sda/code/display-safety/crates/impeller-rs/impeller-cmake -I/mnt/sda/code/display-safety/crates/impeller-rs/impeller-cmake/third_party/abseil-cpp -I/mnt/sda/code/display-safety/crates/impeller-rs/impeller-cmake/third_party -g -std=gnu++20 -MD -MT CMakeFiles/fml.dir/third_party/flutter/fml/synchronization/sync_switch.cc.o -MF CMakeFiles/fml.dir/third_party/flutter/fml/synchronization/sync_switch.cc.o.d -o CMakeFiles/fml.dir/third_party/flutter/fml/synchronization/sync_switch.cc.o -c /mnt/sda/code/display-safety/crates/impeller-rs/impeller-cmake/third_party/flutter/fml/synchronization/sync_switch.cc
  /mnt/sda/code/display-safety/crates/impeller-rs/impeller-cmake/third_party/flutter/fml/synchronization/sync_switch.cc:48:7: error: no matching function for call to 'find'
    if (std::find(observers_.begin(), observers_.end(), observer) ==
        ^~~~~~~~~
  /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate template ignored: could not match 'istreambuf_iterator' against '__normal_iterator'
      find(istreambuf_iterator<_CharT> __first,
      ^
  /mnt/sda/code/display-safety/crates/impeller-rs/impeller-cmake/third_party/flutter/fml/synchronization/sync_switch.cc:56:52: error: too many arguments to function call, expected single argument '__filename', have 3 arguments
    observers_.erase(std::remove(observers_.begin(), observers_.end(), observer),
                     ~~~~~~~~~~~                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/stdio.h:152:12: note: 'remove' declared here
  extern int remove (const char *__filename) __THROW;
             ^
  2 errors generated.

As sync_switch.cc refers to functions defined in <algorithm> I think the header should be present on all platforms.

Expected results

Build should complete without error.

Actual results

Error quoted above.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions