This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1333 - Compiler error for Array wrapper in Eigen 3.3
Summary: Compiler error for Array wrapper in Eigen 3.3
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - expression templates (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - 64-bit All
: Normal Compilation Problem
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-21 00:42 UTC by Yixuan Qiu
Modified: 2019-12-04 16:27 UTC (History)
3 users (show)



Attachments

Description Yixuan Qiu 2016-10-21 00:42:25 UTC
Hi all,

Not sure if this is really a bug, but I detected a compiler error for Array wrapper in Eigen 3.3 that did not occur in Eigen 3.2.x.

A minimal example to reproduce the issue is given below:


========================================================================

#include <Eigen/Core>

template <typename Derived>
double colsum(const Eigen::MatrixBase<Derived>& x)
{
    return x.array().sum();
}

int main()
{
    Eigen::MatrixXd x = Eigen::MatrixXd::Random(5, 5);
    double r = colsum(x.col(0));
    
    return 0;
}

========================================================================


The code works fine with Eigen 3.2.10 but generates the following error with Eigen 3.3-rc1:

########################################################################

./Eigen/src/Core/ArrayWrapper.h:83:48: error: binding ‘const Scalar {aka const double}’ to reference of type ‘Eigen::ArrayWrapper<const Eigen::Block<Eigen::Matrix<double, -1, -1>, -1, 1, true> >::Scalar& {aka double&}’ discards qualifiers
       return m_expression.coeffRef(rowId, colId);
                                                ^
########################################################################


GCC version is 6.2.1.
Comment 1 Gael Guennebaud 2016-10-24 20:24:57 UTC
Fixed: https://bitbucket.org/eigen/eigen/commits/3c986dbcba0c/
Comment 2 Nobody 2019-12-04 16:27:51 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1333.

Note You need to log in before you can comment on or make changes to this bug.