-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Narrows is_copy_constructible specialization for containers #1910
Conversation
This doesn't seem right, because the struct you posted is copy constructible, even with |
This issue is about pybind11 GCC gives |
@wjakob Any chance that this little patch could be considered for 2.3.1, please? |
Hi @sdebionne, I understand the issue, but your fix is much too heavy-weight. Wouldn't the simplest way to defuse this be to add an extra check
? |
@wjakob This is what I had in mind in the first place, but then I thought that, since the specialization if for containers, I should make it more specific (and heavy-weight). It might help to avoid ambiguities if other |
Yes, let's stick with the simpler variant. |
hrrm, or let me think a bit more about it :-) |
Yes, let's stick with the simpler variant here. The specific problem is really just that we don't want an infinite recursion, not that the type does not follow the full container API. |
76d65f9
to
4c769a1
Compare
Done! |
4c769a1
to
53422b4
Compare
You'll have to find a workaround for |
My bad, I forgot it was ccp17. It looks like there is an implementation in |
53422b4
to
b305ab2
Compare
Thanks! |
This try to fix a corner use case that I came across where the type to bind looks like a container (e.g. it has
value_type
andreference
withreference = value_type&
) but it is more like a wrapper, something like:In this case,
is_copy_constructible
is called recursively with the same type and the compiler fails withinvalid use of incomplete type 'struct is_copy_constructible<pixel<char> >'
.This PR narrows the availability of
is_copy_constructible
partial specialization for containers to types that really look like containers.