Skip to content

Conversation

@oremanj
Copy link
Collaborator

@oremanj oremanj commented Oct 15, 2025

Description

Fixes a regression from #5866; see the comments towards the end of that PR. Since the call to cast() invoked an implicit conversion from const itype* to cast_sources, it could be ambiguous with an implicit conversion from const itype* to const itype& or itype&&. Since the latter is under the control of the user, we need to handle the possibility of it existing. Fix by making the cast_sources constructors from const itype* be explicit, and adding forwarding wrappers to allow passing a direct const itype* to cast() and cast_holder().

Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and added commit 384ab4c96618f69c09cad886bca2f4658d378232

(I'm set up to run clang-tidy locally)

@rwgk rwgk merged commit cc36ac5 into pybind:master Oct 15, 2025
85 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Oct 15, 2025
@oremanj oremanj deleted the cast-sources-implicit-fix branch October 15, 2025 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs changelog Possibly needs a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants