Improving static_asserts
Submitted by Gonzalo BG
Assigned to Nobody
Link to original bugzilla bug (#813)
Description
Static asserts in user code read like this:
eigen3/Eigen/src/Core/PlainObjectBase.h:654:7: error: static_assert failed "INVALID_MATRIX_TEMPLATE_PARAMETERS"
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
First of all:
- the whole condition of the static_assert is not shown by current compilers (it has to be all in a single line).
- there is no documentation for EIGEN_IMPLIES. What does it do? I needed to grep within eigen's code to find that:
#define EIGEN_IMPLIES(a,b) (!(a) || (b))
I find it useful to know what the static assert is doing since "INVALID_MATRIX_TEMPLATE_PARAMETERS" doesn't tell me which thing exactly did I got wrong.
Maybe the right thing would be to split the static_assert into smaller ones, such that, you get more informative error messages.
Edited by Eigen Bugzilla