fork(1) download
  1. #include <iostream>
  2.  
  3. template <int i, int j>
  4. void fn()
  5. {
  6. std::cout << "1 ";
  7. fn<i + 1, j>();
  8. }
  9.  
  10. template <int j>
  11. void fn<j, j>()
  12. {
  13. std::cout << "2 ";
  14. }
  15.  
  16. int main()
  17. {
  18. fn<0, 4>();
  19. }
  20.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:11:15: error: non-class, non-variable partial specialization ‘fn<j, j>’ is not allowed
 void fn<j, j>()
               ^
prog.cpp: In instantiation of ‘void fn() [with int i = 899; int j = 4]’:
prog.cpp:7:14:   recursively required from ‘void fn() [with int i = 1; int j = 4]’
prog.cpp:7:14:   required from ‘void fn() [with int i = 0; int j = 4]’
prog.cpp:18:11:   required from here
prog.cpp:7:14: fatal error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum)
  fn<i + 1, j>();
  ~~~~~~~~~~~~^~
compilation terminated.
stdout
Standard output is empty