fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <size_t n> void f(int a[n])
  6. {
  7. cout << n << endl;
  8. }
  9.  
  10. int main()
  11. {
  12. f(new (int[5]));
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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]));
                 ^
stdout
Standard output is empty