-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Function pybind11_select_caster uses ADL to select the caster. #3643
Conversation
- There is no ODR violation when different translation units define different conversions. - The declarations need to be defined in the original namespace.
@henryiii Do we finally need to update MSYS2? |
The 2 mingw failures are some infrastructure issue that we started seeing yesterday, unrelated to this PR. |
"explicit specialization 'void pybind11::detail::cast_safe<void>(pybind11::object &&)' is not a specialization of a function template"
There's an ICE when building with MSVC 2015. Now that it's 2022, I suspect that it's time to retire that compiler.
This ICE was reported to MS--it appears to be a MSVC 2015 update 3 specific bug--but it was long enough ago that the link has become dead: It appears similar to a decltype() adjacent bug reported to boost in 2018: |
We are going to drop Python 2.7-3.5 soon, that was when I was planning to retire the compiler. With What about the failures on 2017? |
Fantastic!
(It's late here, sorry for rambling.) |
@henryiii I haven't yet looked too closely at those, so hard to say yet. I may look tomorrow, but the environment setup is somewhat challenging. Edit: It looks like it's trying to build in C++14 mode to me, but the description line isn't exactly clear about that, and there's no log that I immediately see with the full command line.
And the error is in:
Where |
MSVC I wonder if fixing the 2017 error will help 2015? |
To actually merge this, we probably should either revert the |
Yeah, I was thinking the same, and maybe @amauryfa, too? |
Work continued under #3862. |
Description
Instead of the
type_caster
template specialization, it is possible to register the conversions with a function declaration, which will be found with ADL.The parameter is a pointer to the C++ (intrinsic) type. The returned type is the caster class. This function should have no implementation!
type_caster<T>
will be used as a fallback.type_caster<T>
not always used, I had to update some places withmake_caster<T>
.So far I do not propose to convert the existing casters. I updated the one for
std::string
just to prove the concept, and check that it works on all compilers.