This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45437] Loses reference during update
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Aug 2010 04:32:36 -0000
- Subject: [Bug c++/45437] Loses reference during update
- References: <bug-45437-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from igodard at pacbell dot net 2010-08-28 04:32 -------
Yes, I understand that the comma is not a sequence point, and a may be
evaluated (to a&) in any order w/r/t f() (to bool). But it is not legal to
evaluate a to bool before the call of |=, because |= takes <emp>bool&</emp>,
not <emp>bool</emp>.
If you still don't get my point here please check with someone else. This isn't
the usual side-effect idiocy that you usually get. :-)
Suppose we have:
void g(bool& bref, bool b) { std::cerr << bref << "\n"; }
bool val = false;
bool f(bool& bf) { bf = true; return false; }
g(val, f(val));
you would agree that the language requires that f be called before g and it
prints true because val is never dereferenced as an argument, yes?
--
igodard at pacbell dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437