c++/7135: Faulty Operator Precedence
nathan@gcc.gnu.org
nathan@gcc.gnu.org
Thu Jun 27 07:25:00 GMT 2002
Synopsis: Faulty Operator Precedence
State-Changed-From-To: open->feedback
State-Changed-By: nathan
State-Changed-When: Thu Jun 27 04:14:43 2002
State-Changed-Why:
I beleive the code is ill-formed. I agree the code is
equivalent to
operator<<(operator<<(cout, a.set(5).get()), a.set(30).get());
which I'll rewrite as
Foo (Baz (cout a.Wibble (5)), a.Wobble (30)))
There are 4 sequence points in that, each between
evaluating the parameters to a call, and the call itself.
These sequence points are partially ordered, but not
completely ordered. In particular there is no ordering
between the a.Wobble (30) call and the a.Wibble (5) call.
i.e. in evaluating the argyments to Foo, I could
a.Wobble (30)
a.Wibble (5)
cout
call Baz
call Foo
I cout reorder the a.Wibble and a.Wobble calls. your example
had a.Wobble (5).Fetch1 () and a.Wibble (30).Fetch2 (),
those fetch calls are similarly unorderd. Provided the
appropriate Fetch occurs after the Wibble/Wobble call,
C++ semantics are maintained.
Let me know if you disagree with my analysis
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7135
More information about the Gcc-bugs
mailing list