New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1143 - Parsing error with template in Eigen_Colamd.h
Parsing error with template in Eigen_Colamd.h
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Sparse
3.2
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-05 09:49 UTC by Jérémie
Modified: 2016-01-06 11:04 UTC (History)
2 users (show)



Attachments
Minimal example code to reproduce the bug. (676 bytes, text/x-c++src)
2016-01-05 09:49 UTC, Jérémie
no flags Details

Description Jérémie 2016-01-05 09:49:53 UTC
Created attachment 643 [details]
Minimal example code to reproduce the bug.

In the file Eigen_Colamd.h, the line 519 "if (Col [col].length < 0)" can sometimes lead to compilation errors depending on the surrounding user code.

A seemingly benign minimal example is given in attachment, where the user creates a templated "length" function, included in a header before Eigen. This leads to compilation errors "Eigen_Colamd.h:519:19: error: parse error in template argument list" and "Eigen_Colamd.h:519:5: error: ‘length’ is not a member template function".

Using > instead of < for the comparison does the trick here, but there might be some other places where such an issue can arise.
Comment 1 Christoph Hertzberg 2016-01-06 11:04:38 UTC
Thanks for the report. This is likely caused by a gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10200

I worked-around using parentheses (for devel and 3.2):
https://bitbucket.org/eigen/eigen/commits/667570c89d3
https://bitbucket.org/eigen/eigen/commits/56ce6e48d77

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