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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Feb 19 01:01:50 2019
New Revision: 269003

URL: https://gcc.gnu.org/viewcvs?rev=269003&root=gcc&view=rev
Log:
        PR c++/89336 - multiple stores in constexpr stmt.

If we evaluate the RHS in the context of the LHS, that evaluation might
change the LHS in ways that mess with being able to store the value later.
So for assignment or scalar values, evaluate the RHS first.

        * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
        assigned value.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-89336-1.C
    trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-89336-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c

Reply via email to