-
Notifications
You must be signed in to change notification settings - Fork 3k
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
callback - Relax type-deduction in callback class #3244
Conversation
The type deduction for the callback constructors was to strict and prevented implicit casts for the context pointer stored internally. As noted by @pan-, relaxing the contraints on the templated parameters allows C++ to correctly infer implicit casts such as conversions between child and parent classes when inheritance is involved. As an additional benefit, this may help the user experience by defering invalid type errors to when the types are expanded, limiting the number of error messages presented to users.
Adopting relaxed type-deduction in bound functions better aligns with the same overloads for member functions, and provides an alternative solution for the void pointer cast issue, which removes a large amount of cruft.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/morph test |
1 similar comment
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 1075 Build Prep failed! |
We are currently experiencing internal network issues, the build prep failed because the repo failed to clone within 10 minutes. I'd recommend holding off on CI for the time being until the network issues are resolved. |
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 1077 Build failed! |
Not an actual failure, there was a disk issue that should be resolved now. /morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 1078 All builds and test passed! |
This is a fix for a set of bugs related to using inherited member functions.
The type deduction for the callback constructors was to strict and prevented implicit casts for the context pointer stored internally.
As noted by @pan-, relaxing the contraints on the templated parameters allows C++ to correctly infer implicit casts such as conversions between child and parent classes when inheritance is
involved.
As an additional benefit, this may help the user experience by defering invalid type errors to when the types are expanded, limiting the number of error messages presented to users.
Also, adopting the same relaxed tpye-deduction in bound functions for consistency provides an alternative solution for the void pointer cast issue, which removes a larg amount of cruft.
Github is breaking on the diff, so here is a snippet of what has changed:
related #3235
cc @pan-