Make a foo macro containing a lambda that returns a value and then calls that lambda.
#define foo(...) \ [&](auto&&...args){ \ \ MACRO(__VA_ARGS__); \ return 7; \ }(__VA_ARGS__)
now int x = foo(a, b, c); both will call the lambda inside foo , and inside that lambda will call the macro on (a, b, c) and be able to return the value.
I'm sorry that you save your code further.
source share