fork download
  1. #include <memory>
  3. int main()
  4. {
  5. auto deleter = [](int (*ptr)[]){ };
  6. std::unique_ptr<int[], decltype(deleter)> ptr4(new int[4], deleter);
  7. }
Compilation error #stdin compilation error #stdout 0s 0KB
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:5:35: error: parameter 'ptr' includes pointer to array of unknown bound 'int []'
In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/memory:84:0,
                 from prog.cpp:1:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/bits/unique_ptr.h: In member function 'void std::unique_ptr<_Tp [], _Tp_Deleter>::reset(_Tp*) [with _Tp = int, _Tp_Deleter = main()::<lambda(int (*)[])>, _Tp* = int*]':
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/bits/unique_ptr.h:262:23:   instantiated from 'std::unique_ptr<_Tp [], _Tp_Deleter>::~unique_ptr() [with _Tp = int, _Tp_Deleter = main()::<lambda(int (*)[])>]'
prog.cpp:6:71:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/bits/unique_ptr.h:327:4: error: no match for call to '(std::unique_ptr<int [], main()::<lambda(int (*)[])> >::deleter_type) (int*&)'
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/bits/unique_ptr.h:327:4: note: candidates are: void (*)(int (*)[]) <conversion>
prog.cpp:5:35: note:                 main()::<lambda(int (*)[])>
Standard output is empty