This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/5724: Evaluation order of parameters for multiple operator<< calls
- From: RaoulGough at dial dot pipex dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 18 Feb 2002 19:05:48 -0000
- Subject: c++/5724: Evaluation order of parameters for multiple operator<< calls
- Reply-to: RaoulGough at dial dot pipex dot com
>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: