Skip to content
Snippets Groups Projects
Commit b2b8eb62 authored by Jason Merrill's avatar Jason Merrill
Browse files

c++: Fix C++17 eval order for virtual op=.

In a function call expression in C++17 evaluation of the function pointer is
sequenced before evaluation of the function arguments, but that doesn't
apply to function calls that were written using operator syntax.  In
particular, for operators with right-to-left ordering like assignment, we
must not evaluate the LHS to find a virtual function before we evaluate the
RHS.

gcc/cp/ChangeLog:

	* cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
	the function address if the call used operator syntax.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/eval-order9.C: New test.
parent fabd4f16
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment