public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/59434] New: move_iterator is broken for input iterators with an rvalue as reference type
@ 2013-12-09 15:51 cheparukhin at yandex dot ru
  2013-12-09 16:39 ` [Bug libstdc++/59434] " cheparukhin at yandex dot ru
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: cheparukhin at yandex dot ru @ 2013-12-09 15:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59434

            Bug ID: 59434
           Summary: move_iterator is broken for input iterators with an
                    rvalue as reference type
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cheparukhin at yandex dot ru

move_iterator<Iterator> is correct only for iterators which satisfy forward
iterator requirements in the part that requires Iterator::reference to be the
same as Iterator::value_type.

If the reference type is an rvalue, i.e. a special proxy object implicitly
convertible to value_type (as in vector<bool>), move_iterator::operator*
returns a dangling reference to a local variable, which causes a segmentation
fault (although this doesn't happen with vector<bool> for some reason, but
happens with more complex value_types).

This is because move_iterator<Iterator>::operator* returns
Iterator::value_type&&. I suggest it should return
remove_reference<Iterator::reference>::type&& instead, it seems that in this
case the problem should be solved.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-11 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 15:51 [Bug libstdc++/59434] New: move_iterator is broken for input iterators with an rvalue as reference type cheparukhin at yandex dot ru
2013-12-09 16:39 ` [Bug libstdc++/59434] " cheparukhin at yandex dot ru
2013-12-09 17:48 ` [Bug libstdc++/59434] [lwg/2106] " paolo.carlini at oracle dot com
2014-04-11 19:24 ` glisse at gcc dot gnu.org
2014-04-11 20:13 ` glisse at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).