Opened 7 years ago
Closed 7 years ago
#11517 closed Bugs (fixed)
unused.hpp does not compile with g++ (<= 4.6) and -std=gnu++0x
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | Boost 1.59.0 | Component: | fusion |
Version: | Boost 1.58.0 | Severity: | Problem |
Keywords: | Cc: |
Description
To reproduce, try to execute
g++-4.6 -std=gnu++0x -I. -o /tmp/unused.gch boost/fusion/support/unused.hpp
I obtain
boost/fusion/support/unused.hpp: In member function ‘const boost::fusion::unused_type& boost::fusion::unused_type::operator=(const boost::fusion::unused_type&) const’: boost/fusion/support/unused.hpp:57:9: error: ‘this’ is not a potential constant expression boost/fusion/support/unused.hpp: At global scope: boost/fusion/support/unused.hpp:67:39: error: both ‘const’ and ‘constexpr’ cannot be used here
Such code later became acceptable to g++ but they did not backport the fix beyond 4.7.x ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54086 ). I am able to work around this problem by adding some lines like
#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 6
in the attached file but you probably want a better fix.
Attachments (1)
Change History (8)
by , 7 years ago
Attachment: | unused.hpp added |
---|
follow-up: 2 comment:1 by , 7 years ago
comment:2 by , 7 years ago
Replying to djowel:
why not just switch to a newer compiler?
I personally do use a newer compiler, but I am maintaining a public R package that depends on Boost. Sadly, the officially supported CRAN compiler for Windows is still mingw's g++ 4.6.3 and some users nevertheless prefer to use its incomplete c++0x standard. Another R package maintainer is facing the same problem
https://www.r-project.org/nosvn/R.check/r-release-windows-ix86+x86_64/odeintr-00install.html
If you would like me to use my hack fix, I would understand. But mingw 4.6.3 is still listed as on the Boost webpage as one of the "primary test compilers" for Windows, although I guess without the -std=c++0x flag.
follow-up: 4 comment:3 by , 7 years ago
I will be investigating in this weekend.
Joel, is it reasonable for 1.59.0 release? Because I think the fix (perhaps not only for unused.hpp) will affect all around fusion's code.
comment:4 by , 7 years ago
Replying to Kohei Takahashi <flast@…>:
I will be investigating in this weekend.
Joel, is it reasonable for 1.59.0 release? Because I think the fix (perhaps not only for unused.hpp) will affect all around fusion's code.
Sure. OK, let's do it.
comment:5 by , 7 years ago
Milestone: | To Be Determined → Boost 1.59.0 |
---|
Ah, I misunderstood, it's not a big deal. OK, now I opened a PR to fix this issue: https://github.com/boostorg/fusion/pull/96 .
comment:7 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
why not just switch to a newer compiler?