This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

std::shared_ptr compile error for 2D array type (G++7.2)


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]