diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index c6ffa0d5d..74f2e6f66 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -22,13 +22,8 @@ struct auto_diff_special_op; template struct maybe_coherent_pad_helper { - static constexpr int SizeAtCompileTime = DerivativeType::SizeAtCompileTime == Dynamic || - OtherDerivativeType::SizeAtCompileTime == Dynamic - ? Dynamic - : int(DerivativeType::SizeAtCompileTime) > - int(OtherDerivativeType::SizeAtCompileTime) - ? DerivativeType::SizeAtCompileTime - : OtherDerivativeType::SizeAtCompileTime; + static constexpr int SizeAtCompileTime = + max_size_prefer_dynamic(DerivativeType::SizeAtCompileTime, OtherDerivativeType::SizeAtCompileTime); using type = CoherentPadOp; static type pad(const DerivativeType& x, const OtherDerivativeType& y) { // CoherentPadOp uses variable_if_dynamic. In this case, `SizeAtCompileTime` might