#include <iostream>using namespace std; struct Foo{ template <class T> void bar(T);}; template<>void Foo::bar<int>(int i){ cout << i << '\n';} int main(){ Foo f; f.bar(1); f.bar("Fail!"); return 0;}
Standard input is empty
/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
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!