fork(2) download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. template<typename TYPE>
  5. class Hoge {
  6. public:
  7. void Foo();
  8. };
  9.  
  10. template<typename TYPE>
  11. void Hoge<TYPE>::Foo() {
  12. cout << "Foo_normal" << endl;
  13. }
  14.  
  15. template<>
  16. class Hoge<int> {
  17. public:
  18. void Foo();
  19. };
  20.  
  21. template<>
  22. void Hoge<int>::Foo() {
  23. cout << "Foo_int" << endl;
  24. }
  25.  
  26. int main() {
  27. Hoge<double> a;
  28. a.Foo();
  29. Hoge<int> b;
  30. b.Foo();
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:22:6: error: template-id ‘Foo<>’ for ‘void Hoge<int>::Foo()’ does not match any template declaration
 void Hoge<int>::Foo() {
      ^~~~~~~~~
prog.cpp:18:7: note: candidate is: void Hoge<int>::Foo()
  void Foo();
       ^~~
stdout
Standard output is empty