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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
#c3 in a single testcase without headers:
struct A
{
  int x = 0;
  A & operator ++ () { ++x; return *this; }
};
struct B
{
  A first, second;
  B (A x, A y) : first{x}, second{y} {}
};
struct C
{
  int first, second;
  C (int x, int y) : first{x}, second{y} {}
};

void
foo ()
{
  int i = 0;
  C p{++i, ++i};
  if (p.first != 1 || p.second != 2)
    __builtin_abort ();
}

void
bar ()
{
  int i = 0;
  C p{++i, ++i};
  if (p.first != 1 || p.second != 2)
    __builtin_abort ();
  int &j = i;
  C q{++j, ++j};
  if (q.first != 3 || q.second != 4)
    __builtin_abort ();
}

void
baz ()
{
  int i = 0;
  C p{(int &) ++i, (int &) ++i};
  if (p.first != 1 || p.second != 2)
    __builtin_abort ();
}

void
qux ()
{
  A i;
  B p{++i, ++i};
  if (p.first.x != 1 || p.second.x != 2)
    __builtin_abort ();
}

int
main ()
{
  bar ();
  baz ();
  foo ();
  qux ();
}

Passes with clang++.
Looking at the CALL, e.g. on C::C (&p,  ++i,  ++i) call CALL_EXPR_ORDERED_ARGS
is set and neither CALL_EXPR_REVERSE_ARGS nor CALL_EXPR_OPERATOR_SYNTAX is set.

Reply via email to