Slice syntax v(indices) doesn't check out-of-bound indices
Summary
The slice syntax v(indices) does not throw Assertion index >= 0 && index < size() in debug.
Is there a specific compilation option to turn this verification on?
Environment
- Eigen Version : 3.4 or current master(bd393e15)
- Compiler Version : gcc 10.1.0
- Compile Flags : -g -O0
Minimal Example
#include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::Vector3d v;
v << 100,200,300;
Eigen::Vector3i indices;
indices << 1,2,3;
std::cout
// << v(3) // throws (as long as there is no -DNDEBUG)
<< v(indices) // prints a garbage value at index=3
<< std::endl;
}
What is the current bug behavior?
The code displays whatever (garbage) value is after v.
What is the expected correct behavior?
The code should throw the AssertionError, just like v(3) does.