#include <iostream> using namespace std; template <size_t n> void f(int a[n]) { cout << n << endl; } int main() { f(new (int[5])); return 0; }
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:12:17: error: no matching function for call to ‘f(int*)’ f(new (int[5])); ^ prog.cpp:5:26: note: candidate: ‘template<long unsigned int n> void f(int*)’ template <size_t n> void f(int a[n]) ^ prog.cpp:5:26: note: template argument deduction/substitution failed: prog.cpp:12:17: note: couldn't deduce template parameter ‘n’ f(new (int[5])); ^
Standard output is empty