fork download
  1. #include <iostream>
  2.  
  3. struct C {
  4. template<typename T>
  5. void fn(T);
  6.  
  7. template<size_t N>
  8. void fn(char const (&x)[N]){
  9. std::cout << x << N;
  10. }
  11. template<>
  12. void fn(char const *x){
  13. std::cout << x;
  14. }
  15. } c;
  16.  
  17. int main() {
  18. c.fn("test");
  19. char const a[] = "test";
  20. c.fn(a);
  21. }
Compilation error #stdin compilation error #stdout 0.01s 5504KB
stdin
Standard input is empty
compilation info
prog.cpp:11:11: error: explicit specialization in non-namespace scope ‘struct C’
  template<>
           ^
stdout
Standard output is empty