fork download
  1. #define MAKE_FUNC(FNAME) \
  2. template <typename T> \
  3. inline T ##FNAME## (const T& t) \
  4. {\
  5.   return t; \
  6. }
  7.  
  8. MAKE_FUNC(foo)
  9. MAKE_FUNC(boo)
  10.  
  11. int main()
  12. {
  13. foo(1);
  14. boo(2);
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:1: error: pasting "Tfoo" and "(" does not give a valid preprocessing token
prog.cpp:9:1: error: pasting "Tboo" and "(" does not give a valid preprocessing token
prog.cpp:8: error: ISO C++ forbids declaration of ‘Tfoo’ with no type
prog.cpp:9: error: ISO C++ forbids declaration of ‘Tboo’ with no type
prog.cpp: In function ‘int main()’:
prog.cpp:13: error: ‘foo’ was not declared in this scope
prog.cpp:14: error: ‘boo’ was not declared in this scope
stdout

Standard output is empty