This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/45437] Loses reference during update



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]