]> gcc.gnu.org Git - gcc.git/commit
c++: strict constexpr and local vars
authorJason Merrill <jason@redhat.com>
Sun, 22 May 2022 19:04:33 +0000 (15:04 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 25 May 2022 15:06:36 +0000 (11:06 -0400)
commit6209009df65ff68482ef66951856f50cf362d990
tree400d50b2f5a8debf3c6eecd1f3c9dbd063076a5e
parent1b661f3f5e712c951e774b3b91fffe4dac734cc7
c++: strict constexpr and local vars

A change I was working on made constexpr_searcher.cc start to fail, and when
I looked at it I wondered why it had been accepted before.  This turned out
to be because we try to be more flexible about constant-evaluation of static
initializers, as allowed, but we were wrongly doing the same for non-static
initializers as well.

gcc/cp/ChangeLog:

* constexpr.cc (maybe_constant_init_1): Only pass false for
strict when initializing a variable of static duration.

libstdc++-v3/ChangeLog:

* testsuite/20_util/function_objects/constexpr_searcher.cc: Add
constexpr.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/constexpr-local4.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1y/constexpr-local4.C [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc
This page took 0.060839 seconds and 6 git commands to generate.