PR c++/89336 - multiple stores in constexpr stmt.
authorJason Merrill <jason@redhat.com>
Tue, 19 Feb 2019 01:01:50 +0000 (20:01 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 19 Feb 2019 01:01:50 +0000 (20:01 -0500)
commite8b3c1bc3ba22dcf59b9c743f11d4cb2bc5d7792
tree9c3cdaa34468fdc8816877ce803ffca053288deb
parent44db22fc662edfc4e665f4c523fd75514dfb3be7
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.

From-SVN: r269003
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/g++.dg/cpp1y/constexpr-89336-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/constexpr-89336-2.C [new file with mode: 0644]