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

* [Bug libstdc++/59434] move_iterator is broken for input iterators with an rvalue as reference type
  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 ` cheparukhin at yandex dot ru
  2013-12-09 17:48 ` [Bug libstdc++/59434] [lwg/2106] " paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: cheparukhin at yandex dot ru @ 2013-12-09 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from cheparukhin at yandex dot ru ---
I've found out that this is not a bug in the implementation but an issue in the
standard itself:
http://cplusplus.github.io/LWG/lwg-active.html#2106


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

* [Bug libstdc++/59434] [lwg/2106] move_iterator is broken for input iterators with an rvalue as reference type
  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 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-12-09 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |SUSPENDED
   Last reconfirmed|                            |2013-12-09
            Summary|move_iterator is broken for |[lwg/2106] move_iterator is
                   |input iterators with an     |broken for input iterators
                   |rvalue as reference type    |with an rvalue as reference
                   |                            |type
     Ever confirmed|0                           |1
           Severity|major                       |normal

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Suspending then.


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

* [Bug libstdc++/59434] [lwg/2106] move_iterator is broken for input iterators with an rvalue as reference type
  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
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-04-11 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
Author: glisse
Date: Fri Apr 11 19:23:49 2014
New Revision: 209323

URL: http://gcc.gnu.org/viewcvs?rev=209323&root=gcc&view=rev
Log:
2014-04-11  Marc Glisse  <marc.glisse@inria.fr>

    PR libstdc++/59434
    * include/bits/stl_iterator.h (move_iterator::reference,
    move_iterator::operator*): Implement LWG 2106.
    * testsuite/24_iterators/move_iterator/dr2106.cc: New file.


Added:
    trunk/libstdc++-v3/testsuite/24_iterators/move_iterator/dr2106.cc   (with
props)
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_iterator.h

Propchange: trunk/libstdc++-v3/testsuite/24_iterators/move_iterator/dr2106.cc
            ('svn:eol-style' added)

Propchange: trunk/libstdc++-v3/testsuite/24_iterators/move_iterator/dr2106.cc
            ('svn:keywords' added)


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

* [Bug libstdc++/59434] [lwg/2106] move_iterator is broken for input iterators with an rvalue as reference type
  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
                   ` (2 preceding siblings ...)
  2014-04-11 19:24 ` glisse at gcc dot gnu.org
@ 2014-04-11 20:13 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-04-11 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
I doubt this will be backported, so closing.


^ 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).