-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
etl/delegate: fix accident creation of a delegate to an rvalue delegate when copying/assigning from delegate with mismatching signature #965
Conversation
Thanks, I'll take a look at that when I get back from Spain later this week. |
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.
Does class delegate have any use apart from being a base class 'tag'?
It's mainly a style thing, but when I've done something like this before I've usually just created a simple 'tag' class.
struct delegate_tag {};
class delegate<void>
sort of looks like it should do something useful as a delegate type.
No other use, I simply did not want to pollute the namespace with additional classes |
Should I replace |
…te when copying/assigning from delegate with mismatching signature
Yes, I think so. |
It may be good to make a traits class. template |
Just thought of another addition.
|
I should be able to process this pull request tomorrow afternoon. |
71b691f
into
ETLCPP:pull-request/#965-etl-delegate-fix-accident-creation-of-a-delegate
…opying/assigning from delegate with mismatching signature #966 A constructor for delegate with a freestanding function
…-a-delegate' into development
…opying/assigning from delegate with mismatching signature #966 A constructor for delegate with a freestanding function
Original problem, how to reproduce:
This compiles and does not look suspicious at the first glance but results in a segmentation fault at runtime.
What happens here:
etl::delegate<void(ctx::any ctx)>::create<Test, &Test::CbAnyCtx>(*this);
const TLambda&
.etl::is_same<etl::delegate<TReturn(TParams...)>, TLambda>::value
is false because the signatures of the delegates do not matchThis PR attempts to fix this issue by using a reliable method for checking if a functor is a delegate