Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: XCode compilation error in pybind11 v12.2.0 (pybind11.h, line 1145) #5114

Open
2 of 3 tasks
josephsieh opened this issue Apr 30, 2024 · 0 comments
Open
2 of 3 tasks
Labels
triage New bug, unverified

Comments

@josephsieh
Copy link

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

2.12.0

Problem description

Environment:

Xcode Version: 15.3
Compiler: Apple clang (default)
C++ Language Dialect: C++17 (std=c++17)
Description:

A compilation error occurs when using pybind11 version 12.2.0. The error originates from line 1145 of pybind11.h. There is no issue in 2.11.1 and before.

Error Message:

Loop variable 'kwarg' binds to a temporary value produced by a range of type 'pybind11::dict'

Code Snippet:

static PyObject *dispatcher(PyObject *self, PyObject *args_in, PyObject *kwargs_in) {
...
                    for (const auto &kwarg : kwargs) { // Compiler error (line 1145 of pybind11.h)
                        if (first) {
                            first = false;
                        } else {
                            msg += ", ";
                        }
                        msg += pybind11::str("{}=").format(kwarg.first);
                        try {
                            msg += pybind11::repr(kwarg.second);
                        } catch (const error_already_set &) {
                            msg += "<repr raised Error>";
                        }
                    }
...
}

Reproducible example code

No response

Is this a regression? Put the last known working version here if it is.

2.11.1

@josephsieh josephsieh added the triage New bug, unverified label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New bug, unverified
Projects
None yet
Development

No branches or pull requests

1 participant