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

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