Closed
Description
Description
Example code:
#include "mbed.h"
void another_callback(nsapi_event_t status, intptr_t param)
{
printf("another_callback called\r\n");
}
mbed::Callback<void(nsapi_event_t, intptr_t)> test(mbed::Callback<void(nsapi_event_t, intptr_t)> arg)
{
return arg;
}
int main()
{
printf("Status callback example!\r\n");
mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb = callback(&another_callback);
mbed::Callback<void(nsapi_event_t, intptr_t)> another_cb = test(status_cb);
if (another_cb == status_cb) {
printf("Callbacks are the same\r\n");
} else {
printf("Callbacks are NOT SAME\r\n");
}
}
I would expect callbacks to return true for the comparison operation as those are exacly copies of the same object.
Directly copying the callbacks leads the comparison to return true, but passing it as a parameter to functions seems to lead it to return false.
Issue request type
[ ] Question
[ ] Enhancement
[X] Bug