fork(3) download
  1. #include <iostream>
  2.  
  3. template <int Arg>
  4. void foo()
  5. {
  6. std::cout << Arg << ' ';
  7. }
  8.  
  9. template <int First, int... Rest>
  10. void foo()
  11. {
  12. std::cout << First << ' ';
  13. foo<Rest...>();
  14. }
  15.  
  16. int main()
  17. {
  18. foo<1, 2, 3>();
  19.  
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘void foo() [with int First = 2; int ...Rest = {3}]’:
prog.cpp:13:14:   required from ‘void foo() [with int First = 1; int ...Rest = {2, 3}]’
prog.cpp:18:15:   required from here
prog.cpp:13:14: error: call of overloaded ‘foo()’ is ambiguous
  foo<Rest...>();
  ~~~~~~~~~~~~^~
prog.cpp:4:6: note: candidate: void foo() [with int Arg = 3]
 void foo()
      ^~~
prog.cpp:10:6: note: candidate: void foo() [with int First = 3; int ...Rest = {}]
 void foo()
      ^~~
stdout
Standard output is empty