[Bug libstdc++/51823] reverse iterator instantiated with POD type returns uninitialized values + work around
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 11 14:19:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51823
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Last reconfirmed| |2012-01-11
Resolution|INVALID |
Ever Confirmed|0 |1
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-11 14:17:34 UTC ---
actually, my bad, even if your type did meet the requirements it wouldn't work,
and that *is* a libstdc++ bug
at some point between C++03 and C++11 the definition of
reverse_iterator::operator* was changed to clarify this, making libstdc++'s
implementation wrong. The standard now says:
[ Note: This operation must use an auxiliary member variable rather than a
temporary variable to avoid returning a reference that persists beyond the
lifetime of its associated iterator. (See 24.2.) —end note ]
More information about the Gcc-bugs
mailing list