Skip to content

Using back_inserter without the std:: prefix #4113

Description

@thraneh

I have a custom container with appropriate iterators, push_back method, etc. This used to work up until fmt 10.0.2

I haven't yet been able to set up a minimal example to reproduce this.

However, the issue arise from this line where back_inserter is used without the std:: prefix (maybe you wanted to use your own invoke_back_inserter?)

The issue was seen when compiling C++23

GCC 14.1.0 (Linux)

.../opt/conda/envs/dev/include/fmt/base.h:1089:48: error: 'back_inserter' was not declared in this scope; did you mean 'std::back_inserter'?
 1089 |   auto out() -> OutputIt { return back_inserter(container_); }
      |                                   ~~~~~~~~~~~~~^~~~~~~~~~~~
      |                                   std::back_inserter

Clang 18.1.8 (MacOS)

.../opt/conda/envs/dev/include/fmt/base.h:1089:35: error: use of undeclared identifier 'back_inserter'
 1089 |   auto out() -> OutputIt { return back_inserter(container_); }
      |

I can work around this by defining back_inserter in the global namespace before including any of the fmt headers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions