This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
std::shared_ptr compile error for 2D array type (G++7.2)
- From: goldenhawking <goldenhawking at 163 dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Fri, 6 Oct 2017 16:47:49 +0800
- Subject: std::shared_ptr compile error for 2D array type (G++7.2)
- Authentication-results: sourceware.org; auth=none
We use std::shared_ptr to hold 2D array like this:
std::shared_ptr< int[24] > bar(new int[N][24], [=](int(*p)[24])->void {
delete[] p; } );
GNU C++ 4/5/6 is ok . GNU C++ 7.2 gives an error message:
error: no matching function for call to 'std::shared_ptr<int
[24]>::shared_ptr(int (*)[24])' shared_ptr< int [24] > pt (new int
[4096][24]);
This may be a problem caused by default construct mechanism of a 2D array.