You can see the result after preprocessing ( -Efor gcc) ...
This is the code in which I added using a macro:
struct caller {
template <class T> caller(T fun) { fun(); }
};
# define CAT2(X, Y) X ## Y
# define CAT(X, Y) CAT2(X, Y)
# define TEST(NAME) caller CAT(__VAR, __LINE__) = []
TEST(disengaged_ctor) { foo(); };
after preprocessing the last line turns into:
caller __VAR10 = []{ foo(); };
I am a little puzzled __VARand unused NAME*. However, it []{ foo(); }is a lambda, which when used to create callergets a call in the constructor caller.
* = , : , , __VAR10, 10 TEST(disengaged_ctor), .. NAME .