placement array new doesn't work for Eigen types
Submitted by scott snyder
Assigned to Nobody
Link to original bugzilla bug (#708)
Description
hi -
Some of the Eigen objects define their own new/delete operators.
However, these definitions omit placement array new (but both
array new and placement new are there).
As an example, this doesn't compile (tested against eigen-63c58c84,
but from inspection of the source in the repository, this should still
be there in the latest version):
#include <Eigen/Core>
{
return new (p) Eigen::Matrix<double, 3, 1>[sz];
}
void* test(size_t sz, void* p)This gives a compilation error starting with
etest.cc:5:48: error: no matching function for call to ‘Eigen::Matrix<double, 3, 1>::operator new [](sizetype, void*&)’
return new (p) Eigen::Matrix<double, 3, 1>[sz];
^
etest.cc: In function ‘void* test(std::size_t, void*)’:This came about trying to generate wrappers for calling Eigen objects
from python / interpreted C++ using root (http://root.cern.ch);
the automatically-generated wrapper code calls placement array new.
If i add a definition for placement array new along the lines of the
existing non-array placement new (see attached patch), then the error
goes away.
thanks,
sss