]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: check DECL_INITIAL for constexpr
authorJason Merrill <jason@redhat.com>
Tue, 20 Sep 2022 21:12:29 +0000 (17:12 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 29 Sep 2022 17:50:54 +0000 (13:50 -0400)
commit73d9b0e5947e162386f7e25d3851097cee1bb366
tree4ba1a5ad4680256996b60ca0e0f58fa8e965656a
parentbbdb5612f6661f2c64b0c0f1d2291cb59fde2b40
c++: check DECL_INITIAL for constexpr

We were overlooking non-potentially-constant bits in variable initializer
because we didn't walk into DECL_INITIAL.

gcc/cp/ChangeLog:

* constexpr.cc (potential_constant_expression_1): Look into
DECL_INITIAL.  Use location wrappers.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/constexpr-local4.C: Expect error sooner.
* g++.dg/cpp2a/consteval24.C: Likewise.
* g++.dg/cpp2a/consteval7.C: Likewise.
* g++.dg/cpp2a/inline-asm3.C: Likewise.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1y/constexpr-local4.C
gcc/testsuite/g++.dg/cpp2a/consteval24.C
gcc/testsuite/g++.dg/cpp2a/consteval7.C
gcc/testsuite/g++.dg/cpp2a/inline-asm3.C