Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5475: [Foreach] rvalue reference binding of temporary ranges
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-16 07:09:39
#5475: [Foreach] rvalue reference binding of temporary ranges
--------------------------------------+-------------------------------------
Reporter: mimomorin@⦠| Owner: eric_niebler
Type: Patches | Status: closed
Milestone: To Be Determined | Component: foreach
Version: Boost Development Trunk | Severity: Problem
Resolution: fixed | Keywords: foreach, C++0x
--------------------------------------+-------------------------------------
Comment (by Michel Morin <mimomorin@â¦>):
The current implementation of C++11 BOOST_FOREACH is based on
**`decltype`**.
However, gcc-4.4 has a bug that prevents us from using `decltype` in
`BOOST_FOREACH`.
(The bug has been fixed in gcc-4.5 and newer versions.)
The reason I used `decltype` rather than `auto` is that
* `auto &&` is buggy in gcc-4.4.*, 4.5.*, 4.6.0 and so we should not use
it. (This bug is already fixed in gcc-4.6.1 and 4.7.)
* `decltype` is more widely available than `auto`.
* binding rvalue ranges to **const** references can be easily implemented
with `decltype` than with `auto`.
Short-term fixed would be:
A. Revert to C++03 BOOST_FOREACH on gcc-4.4
B. Disable **const** reference biding of rvalue ranges on gcc-4.4. That
is, rvalue ranges are bound to **const or non-const** rvalue ranges using
`auto &&`. In spite of the above bug, `auto &&` can be safely used in
gcc-4.4, since lvalues are allowed to be bound to rvalue references in
gcc-4.4.
A and B are extremely easy to do without causing any error.
Long-term fixed would be
C. Implement "**const** reference binding of rvalue ranges" with `auto &&`
on gcc-4.4. I already implemented it in this
[[http://lists.boost.org/Archives/boost/2011/04/180591.php|post]].
Comments? I'm ready to make patches.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5475#comment:23> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC