fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Foo
  5. {
  6. template <class T>
  7. void bar(T);
  8. };
  9.  
  10. template<>
  11. void Foo::bar<int>(int i)
  12. {
  13. cout << i << '\n';
  14. }
  15.  
  16. int main()
  17. {
  18. Foo f;
  19.  
  20. f.bar(1);
  21. f.bar("Fail!");
  22.  
  23. return 0;
  24. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
/home/5dOyCN/ccBuZJKP.o: In function `main':
prog.cpp:(.text.startup+0x2a): undefined reference to `void Foo::bar<char const*>(char const*)'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty