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: Ben Goodrich <goodrich.ben@…> 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)

unused.hpp (2.6 KB ) - added by Ben Goodrich <goodrich.ben@…> 7 years ago.

Download all attachments as: .zip

Change History (8)

by Ben Goodrich <goodrich.ben@…>, 7 years ago

Attachment: unused.hpp added

comment:1 by Joel de Guzman, 7 years ago

why not just switch to a newer compiler?

in reply to:  1 comment:2 by Ben Goodrich <goodrich.ben@…>, 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.

comment:3 by Kohei Takahashi <flast@…>, 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.

in reply to:  3 comment:4 by Joel de Guzman, 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 Kohei Takahashi <flast@…>, 7 years ago

Milestone: To Be DeterminedBoost 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:6 by Kohei Takahashi <flast@…>, 7 years ago

Joel, it should be fixed in 1.59 release. Please close this ticket.

comment:7 by Joel de Guzman, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.