On Sunday, June 18, 2023 at 2:50:54 AM UTC+1, Andrey Tarasevich wrote:
>
> "This works fine"? Really? Lambda expression in C++ is a prvalue. How
> did you manage to pass it by an lvalue reference?
I had changed it to "Lambda const &f" before copy-pasting.
> Anyhoo, what role does the lambda play here anyway? Why not just
>
> int main(void)
> {
> NoSanitizeAddress(SomeFunction);
> }
Because it might be more complex:
bool retval;
NoSanitizeAddress( [&argc,argv,&retval](void) -> void { retval = SomeFunc(++argc,argv); } );