This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1153 - compilation will fail on gcc [4.3, 4.6) if c++11 support is enabled.
Summary: compilation will fail on gcc [4.3, 4.6) if c++11 support is enabled.
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.2
Hardware: All All
: Normal Compilation Problem
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-25 18:31 UTC by travis abbott
Modified: 2019-12-04 15:22 UTC (History)
3 users (show)



Attachments

Description travis abbott 2016-01-25 18:31:04 UTC
In commit c280e90, support for rvalue references was added. That same commit introduced a define "EIGEN_HAVE_RVALUE_REFERENCES". For gcc, this is set to true any time __GXX_EXPERIMENTAL_CXX0X__ is defined. This makes sense; rvalue references were introduced at the same time as that macro (in gcc 4.3). That said, there is code that is enabled by this macro that uses "nullptr"--a feature that wasn't introduced until gcc 4.6.

The upshot is that gcc 4.3, 4.4, and 4.5 can not #include <Eigen/Dense> when the -std=c++0x flag is in use.

My suggestion: replace the use of nullptr with 0 to retain compatibility with old compilers.
Comment 1 Gael Guennebaud 2016-01-25 20:31:41 UTC
I don't really see the point in supporting experimental features of pretty old compiler versions, if you need C++11 features, then use a compiler that truly support it. (gcc 4.6 was released almost 5 years ago).


Today, replacing nullptr by 0 might be enough, but tomorrow Eigen will very likely rely on other non implemented C++11 features in such old compiler in C++11 mode.
Comment 2 travis abbott 2016-01-25 20:48:21 UTC
(In reply to Gael Guennebaud from comment #1)
> I don't really see the point in supporting experimental features of pretty
> old compiler versions, if you need C++11 features, then use a compiler that
> truly support it. (gcc 4.6 was released almost 5 years ago).
> 
> 
> Today, replacing nullptr by 0 might be enough, but tomorrow Eigen will very
> likely rely on other non implemented C++11 features in such old compiler in
> C++11 mode.

It would be great if it were up to me, but the compiler versions I am required to support at work is not my decision.

It's not really that I want Eigen to support some C++11 features, it's that I do not want it to assume that C++11 is fully implemented when it detects experimental support via the aforementioned macro and then fail to compile.

One other way to do this would be to add a way to forcefully disable C++11 (e.g., EIGEN_NO_CXX11).
Comment 3 Christoph Hertzberg 2016-01-25 21:13:06 UTC
I guess we should simply remove the line
     defined(__GXX_EXPERIMENTAL_CXX0X__) || \
from Macros.h (and perhaps any other reference to __GXX_EXPERIMENTAL_CXX0X__, if there are any?). We do claim to support GCC 4.1 and newer -- but we don't promise to support experimental extensions.
Comment 4 Gael Guennebaud 2016-01-25 21:15:22 UTC
oh, right, those should definitely be removed!
Comment 5 Christoph Hertzberg 2016-01-26 15:57:51 UTC
Fixed in devel and 3.2:
https://bitbucket.org/eigen/eigen/commits/9eb1bc9
https://bitbucket.org/eigen/eigen/commits/c1119f9

There are two references left in unsupported/test/mpreal/mpreal.h which I did not touch, as they should not influence Eigen itself in any way.
Comment 6 Nobody 2019-12-04 15:22:26 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/1153.

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