Core: Make structured-bindings tuple_size SFINAE-friendly for dynamic sizes

libeigen/eigen!2828

Closes #3103

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-08-17 10:12:24 -07:00
co-authored by Rasmus Munk Larsen
parent 14d33f2f2e
commit 76a7c53018
4 changed files with 74 additions and 37 deletions
@@ -1,9 +1,8 @@
#include "../Eigen/Core"
// Reproduces the "Dynamic-sized Matrix breaks tuple_size" bug reported on !2336.
// With an enable_if_t base-clause the error is a cryptic non-SFINAE hard error;
// with our static_assert-in-body fix it becomes a friendly diagnostic. Either
// way, the compile must fail for MatrixXd.
// tuple_size<MatrixXd> is a SFINAE-friendly empty specialization (issue #3103),
// so naming ::value outside a SFINAE context must still fail to compile.
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define ROWS Eigen::Dynamic
#define COLS Eigen::Dynamic