c++/5724: Evaluation order of parameters for multiple operator<< calls
RaoulGough@dial.pipex.com
RaoulGough@dial.pipex.com
Mon Feb 18 12:50:00 GMT 2002
>Number: 5724
>Category: c++
>Synopsis: Evaluation order of parameters for multiple operator<< calls
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 18 11:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Raoul Gough
>Release: 2.95.3-5
>Organization:
>Environment:
Cygwin on Windows 2000
>Description:
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.
>How-To-Repeat:
g++ gccseqtest.cc -o gccseqtest
./gccseqtest
Produces:
121
122
I think this should be:
122
122
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list