This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29542] Error compiling c++ program with overloaded operator<< and postfix increment when using them (cout << obj++)
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Oct 2006 23:04:37 -0000
- Subject: [Bug c++/29542] Error compiling c++ program with overloaded operator<< and postfix increment when using them (cout << obj++)
- References: <bug-29542-13442@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-10-21 23:04 -------
Your code is incorrect, you cannot bind a rvalue to a (non-const) reference.
The way to fix it is do:
friend ostream &operator <<(ostream &, const test &);
ostream &operator <<(ostream &out, const test &tt)
Note the error message is not giving a good error message but that is a
different bug, PR 21631.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29542