fork download
  1. class foo
  2. {
  3. template <typename T>
  4. friend T func();
  5. };
  6.  
  7. template <typename T=int>
  8. T func()
  9. {
  10. return T();
  11. }
  12.  
  13. int main() {return 0;}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:3: error: redeclaration of friend ‘template<class T> T func()’ may not have default template arguments
prog.cpp:4:14: error: ‘template<class T> T func()’ previously declared here
stdout
Standard output is empty