I have an example where cout << f(a) << f(b); is calling f(b) before f(a), which I think is wrong. The operator<< is (in this case) a function call, so there should be a sequence point which guarantees evaluation order. My apologies for submitting a bug on an old version. Release: 2.95.3-5 Environment: Cygwin on Windows 2000 How-To-Repeat: g++ gccseqtest.cc -o gccseqtest ./gccseqtest Produces: 121 122 I think this should be: 122 122
State-Changed-From-To: open->closed State-Changed-Why: no, there is no sequence point there. The code is equivalent of output (output (cout, f (a)), f (b)); where 'output' is the operator<< function. you'll see that 'f (b)' can be called before or after 'output (cout, f (a))'
From: Graham Stott <grahams@redhat.com> To: RaoulGough@dial.pipex.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/5724: Evaluation order of parameters for multiple operator<< calls Date: Mon, 18 Feb 2002 20:18:34 +0000 Please supply a complete testcase.
Reopening to mark as a duplicate of...
...PR 11751. *** This bug has been marked as a duplicate of 11751 ***