bug #1676: workaround GCC's bug in c++17 mode.

(grafted from b3c4344a6852e55c849976dd46ec4e861399bf16
)
This commit is contained in:
Gael Guennebaud 2019-02-07 15:21:35 +01:00
parent f1c12d8ff0
commit 2aa9eb3ce8
3 changed files with 6 additions and 9 deletions

View File

@ -40,7 +40,7 @@ static inline void check_DenseIndex_is_signed() {
*/ */
template<typename Derived> class DenseBase template<typename Derived> class DenseBase
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
: public DenseCoeffsBase<Derived> : public DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value>
#else #else
: public DenseCoeffsBase<Derived,DirectWriteAccessors> : public DenseCoeffsBase<Derived,DirectWriteAccessors>
#endif // not EIGEN_PARSED_BY_DOXYGEN #endif // not EIGEN_PARSED_BY_DOXYGEN
@ -71,7 +71,7 @@ template<typename Derived> class DenseBase
typedef Scalar value_type; typedef Scalar value_type;
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseCoeffsBase<Derived> Base; typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
using Base::derived; using Base::derived;
using Base::const_cast_derived; using Base::const_cast_derived;

View File

@ -47,11 +47,7 @@ template<typename T> struct NumTraits;
template<typename Derived> struct EigenBase; template<typename Derived> struct EigenBase;
template<typename Derived> class DenseBase; template<typename Derived> class DenseBase;
template<typename Derived> class PlainObjectBase; template<typename Derived> class PlainObjectBase;
template<typename Derived, int Level> class DenseCoeffsBase;
template<typename Derived,
int Level = internal::accessors_level<Derived>::value >
class DenseCoeffsBase;
template<typename _Scalar, int _Rows, int _Cols, template<typename _Scalar, int _Rows, int _Cols,
int _Options = AutoAlign | int _Options = AutoAlign |

View File

@ -112,6 +112,7 @@ void matlab_cplx_cplx(const M& ar, const M& ai, const M& br, const M& bi, M& cr,
cr.noalias() -= ai * bi; cr.noalias() -= ai * bi;
ci.noalias() += ar * bi; ci.noalias() += ar * bi;
ci.noalias() += ai * br; ci.noalias() += ai * br;
// [cr ci] += [ar ai] * br + [-ai ar] * bi
} }
void matlab_real_cplx(const M& a, const M& br, const M& bi, M& cr, M& ci) void matlab_real_cplx(const M& a, const M& br, const M& bi, M& cr, M& ci)
@ -240,7 +241,7 @@ int main(int argc, char ** argv)
blas_gemm(a,b,r); blas_gemm(a,b,r);
c.noalias() += a * b; c.noalias() += a * b;
if(!r.isApprox(c)) { if(!r.isApprox(c)) {
std::cout << r - c << "\n"; std::cout << (r - c).norm() << "\n";
std::cerr << "Warning, your product is crap!\n\n"; std::cerr << "Warning, your product is crap!\n\n";
} }
#else #else
@ -249,7 +250,7 @@ int main(int argc, char ** argv)
gemm(a,b,c); gemm(a,b,c);
r.noalias() += a.cast<Scalar>() .lazyProduct( b.cast<Scalar>() ); r.noalias() += a.cast<Scalar>() .lazyProduct( b.cast<Scalar>() );
if(!r.isApprox(c)) { if(!r.isApprox(c)) {
std::cout << r - c << "\n"; std::cout << (r - c).norm() << "\n";
std::cerr << "Warning, your product is crap!\n\n"; std::cerr << "Warning, your product is crap!\n\n";
} }
} }