fork(3) download
  1. void baz();
  2. void baz(int);
  3.  
  4. template<typename... Args, typename R>
  5. void bar(R (*)(Args...));
  6.  
  7. template<typename... Args>
  8. void foo()
  9. {
  10. bar<Args...>(baz);
  11. }
  12.  
  13. int main()
  14. {
  15. foo<>(); // Deduces baz()
  16. //bar<>(baz); // Ambiguous
  17. foo<int>(); // Deduces baz(int)
  18. bar<int>(baz); // Deduces baz(int)
  19. //foo<void>(); // Ambiguous
  20. //bar<void>(baz); // Ambiguous
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/vbG5Ns/ccuvpvls.o: In function `main':
prog.cpp:(.text.startup+0x12): undefined reference to `baz()'
prog.cpp:(.text.startup+0x17): undefined reference to `void bar<, void>(void (*)())'
prog.cpp:(.text.startup+0x1e): undefined reference to `baz(int)'
prog.cpp:(.text.startup+0x23): undefined reference to `void bar<int, void>(void (*)(int))'
prog.cpp:(.text.startup+0x2a): undefined reference to `baz(int)'
prog.cpp:(.text.startup+0x2f): undefined reference to `void bar<int, void>(void (*)(int))'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty