I am using assertion macro from assert.h I have defined lambda to perform assertion checking.
int val1 = 0;
int val2 = 1;
const auto check = [val1,val2]()-> bool
{
return val1 < val2;
};
// no error for this call
assert(check() && "Test is failed");
// no error for this call
assert([=]()-> bool
{
return val1 < val2;
}() && "Test is failed");
//compile error for this call "too many arguments provided to function-like macro invocation" assert([val1,val2]()-> bool { return val1 < val2; }() && "Test is failed");
why I am getting
too many arguments provided to function-like macro invocation
compile error for the case when I am using assert macro and defining lambda with more than one argument in the capture list?