public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented
@ 2015-03-24 17:41 rs2740 at gmail dot com
  2015-03-24 17:42 ` [Bug libstdc++/65543] " rs2740 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rs2740 at gmail dot com @ 2015-03-24 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65543

            Bug ID: 65543
           Summary: rvalue stream insertion and extraction operators
                    incorrectly implemented
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com

Repro:

#include <iostream>
#include <sstream>

struct A{};

void operator<<(std::ostream &, A const &){ }
void operator>>(std::istream &, A &){ }

int main()
{
    A a;

    std::ostringstream() << a;
    std::istringstream() >> a;

    return 0;
}

The standard says that operator<< for rvalue streams performs `os << x` and
returns `os`. The libstdc++ implementation instead does 

return (__os << __x);

which breaks if the operator<< called does not return a reference stream. A
similar issue affects operator>> for rvalue streams.


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

* [Bug libstdc++/65543] rvalue stream insertion and extraction operators incorrectly implemented
  2015-03-24 17:41 [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented rs2740 at gmail dot com
@ 2015-03-24 17:42 ` rs2740 at gmail dot com
  2015-03-25 10:16 ` paolo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rs2740 at gmail dot com @ 2015-03-24 17:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65543

--- Comment #1 from TC <rs2740 at gmail dot com> ---
(In reply to TC from comment #0)

> which breaks if the operator<< called does not return a reference stream. A
> similar issue affects operator>> for rvalue streams.

I meant "a reference to the stream".


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

* [Bug libstdc++/65543] rvalue stream insertion and extraction operators incorrectly implemented
  2015-03-24 17:41 [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented rs2740 at gmail dot com
  2015-03-24 17:42 ` [Bug libstdc++/65543] " rs2740 at gmail dot com
@ 2015-03-25 10:16 ` paolo at gcc dot gnu.org
  2015-03-25 13:21 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-03-25 10:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65543

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Mar 25 09:57:06 2015
New Revision: 221655

URL: https://gcc.gnu.org/viewcvs?rev=221655&root=gcc&view=rev
Log:
2015-03-25  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/65543
    * include/std/istream (operator>>(basic_istream<>&&, _Tp&): Revert
    thinko in r150387.
    * include/std/ostream (operator<<(basic_ostream<>&&, const _Tp&):
    Likewise.
    * testsuite/27_io/rvalue_streams-2.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/istream
    trunk/libstdc++-v3/include/std/ostream


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

* [Bug libstdc++/65543] rvalue stream insertion and extraction operators incorrectly implemented
  2015-03-24 17:41 [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented rs2740 at gmail dot com
  2015-03-24 17:42 ` [Bug libstdc++/65543] " rs2740 at gmail dot com
  2015-03-25 10:16 ` paolo at gcc dot gnu.org
@ 2015-03-25 13:21 ` paolo at gcc dot gnu.org
  2015-03-25 13:27 ` paolo at gcc dot gnu.org
  2015-03-25 14:38 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-03-25 13:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65543

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Mar 25 12:55:04 2015
New Revision: 221663

URL: https://gcc.gnu.org/viewcvs?rev=221663&root=gcc&view=rev
Log:
2015-03-25  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/65543
    * include/std/istream (operator>>(basic_istream<>&&, _Tp&): Revert
    thinko in r150387.
    * include/std/ostream (operator<<(basic_ostream<>&&, const _Tp&):
    Likewise.
    * testsuite/27_io/rvalue_streams-2.cc: New.

Added:
    branches/gcc-4_9-branch/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc
Modified:
    branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_9-branch/libstdc++-v3/include/std/istream
    branches/gcc-4_9-branch/libstdc++-v3/include/std/ostream


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

* [Bug libstdc++/65543] rvalue stream insertion and extraction operators incorrectly implemented
  2015-03-24 17:41 [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented rs2740 at gmail dot com
                   ` (2 preceding siblings ...)
  2015-03-25 13:21 ` paolo at gcc dot gnu.org
@ 2015-03-25 13:27 ` paolo at gcc dot gnu.org
  2015-03-25 14:38 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-03-25 13:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65543

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Mar 25 12:55:22 2015
New Revision: 221664

URL: https://gcc.gnu.org/viewcvs?rev=221664&root=gcc&view=rev
Log:
2015-03-25  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/65543
    * include/std/istream (operator>>(basic_istream<>&&, _Tp&): Revert
    thinko in r150387.
    * include/std/ostream (operator<<(basic_ostream<>&&, const _Tp&):
    Likewise.
    * testsuite/27_io/rvalue_streams-2.cc: New.

Added:
    branches/gcc-4_8-branch/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc
Modified:
    branches/gcc-4_8-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_8-branch/libstdc++-v3/include/std/istream
    branches/gcc-4_8-branch/libstdc++-v3/include/std/ostream


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

* [Bug libstdc++/65543] rvalue stream insertion and extraction operators incorrectly implemented
  2015-03-24 17:41 [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented rs2740 at gmail dot com
                   ` (3 preceding siblings ...)
  2015-03-25 13:27 ` paolo at gcc dot gnu.org
@ 2015-03-25 14:38 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-25 14:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65543

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|5.0                         |4.8.5

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 5.0, 4.9.3, 4.8.5.


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

end of thread, other threads:[~2015-03-25 13:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 17:41 [Bug libstdc++/65543] New: rvalue stream insertion and extraction operators incorrectly implemented rs2740 at gmail dot com
2015-03-24 17:42 ` [Bug libstdc++/65543] " rs2740 at gmail dot com
2015-03-25 10:16 ` paolo at gcc dot gnu.org
2015-03-25 13:21 ` paolo at gcc dot gnu.org
2015-03-25 13:27 ` paolo at gcc dot gnu.org
2015-03-25 14:38 ` paolo.carlini at oracle dot com

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