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++/78734] New: [C++17] P0145R3: function arguments are indeterminately sequenced


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78734

            Bug ID: 78734
           Summary: [C++17] P0145R3: function arguments are
                    indeterminately sequenced
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

P0145R3 says that function arguments are indeterminately sequenced.

Consider the following example from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0431r0.htm:

markus@x4 /tmp % cat order.cpp
#include <stdio.h>
void foo(int a, int b, int c) { printf("%d %d %d\n", a, b, c); }
int main() {
  int i = 0;
  foo(++i, ++i, ++i);
}

markus@x4 /tmp % g++ -std=c++1z  order.cpp
markus@x4 /tmp % ./a.out
3 3 3

This is wrong. It should be a permutation of "1 2 3".

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