fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T, size_t N>
  5. void sink(T (&)[N]) {}
  6.  
  7. int main() {
  8. int array[] = {1,2,3};
  9. sink(array);
  10. sink(&array[0]);
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 3136KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:10:16: error: no matching function for call to 'sink(int*)'
  sink(&array[0]);
                ^
prog.cpp:10:16: note: candidate is:
prog.cpp:5:6: note: template<class T, unsigned int N> void sink(T (&)[N])
 void sink(T (&)[N]) {}
      ^
prog.cpp:5:6: note:   template argument deduction/substitution failed:
prog.cpp:10:16: note:   mismatched types 'T [N]' and 'int*'
  sink(&array[0]);
                ^
stdout
Standard output is empty