You need to defer the use of the marker until the place and line parameters are recursively expanded in the CALL_LATER2 macro. You do this by moving ## operations to a separate macro β until ## appears in the body of CALL_LATER2 , all its arguments will be pre-copied for the macros:
#define XCAT3(a, b, c) a ## b ## c #define CALL_LATER2(fun, h, place, line) \ auto XCAT3(calllater, place, line) = \ call_later((fun), (h));
However, it still wonβt do what you want, since __FUNCTION__ expands the string with the characters " , and not what can be inserted into the identifier. Instead, you just need to create your created name __LINE__ and make sure that you you can get duplicates in different compilation units, this is not a problem (if they are local to any function, this should be good, or you can put them in an anonymous namespace.)
source share