fork download
  1. template <typename T>
  2. struct A
  3. {
  4. friend void foo() {}
  5. };
  6.  
  7. int main()
  8. {
  9. A<char> a1;
  10. A<double> a2;
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘A<double>’:
prog.cpp:10:   instantiated from here
prog.cpp:4: error: redefinition of ‘void foo()’
prog.cpp:4: error: ‘void foo()’ previously defined here
prog.cpp: In function ‘int main()’:
prog.cpp:9: warning: unused variable ‘a1’
prog.cpp:10: warning: unused variable ‘a2’
stdout
Standard output is empty