check_that_malloc_is_allowed() is not always called in aligned_realloc()
Summary
It is possible to conservativeResize() a matrix when heap allocations are forbidden (with EIGEN_NO_MALLOC or EIGEN_RUNTIME_NO_MALLOC & Eigen::internal::set_is_malloc_allowed(false))
aligned_realloc() calls aligned_malloc() if ptr == 0 (see https://gitlab.com/libeigen/eigen/-/blob/master/Eigen/src/Core/util/Memory.h#L217) but shouldn't we just always call check_that_malloc_is_allowed() instead ?
Relevant MR: !1014 (merged)
Minimal Example
#define EIGEN_RUNTIME_NO_MALLOC 1
#include <iostream>
#include <Eigen/Core>
int main() {
Eigen::VectorXd x;
x.conservativeResize(10);
Eigen::internal::set_is_malloc_allowed(false);
// Eigen::VectorXd y(2); // Correctly fails.
x.conservativeResize(100); // Incorrectly passes.
std::cout << x << std::endl;
return 0;
}
https://godbolt.org/z/1s5K6TrWa
What is the expected correct behavior?
Resizing a vector with heap allocations disabled should trigger an assertion.