]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: crash with anon VAR_DECL [PR116676]
authorMarek Polacek <polacek@redhat.com>
Mon, 16 Sep 2024 20:42:38 +0000 (16:42 -0400)
committerMarek Polacek <polacek@redhat.com>
Tue, 17 Sep 2024 16:37:05 +0000 (12:37 -0400)
commit9046f9aeae0f926e7365d39809a80855e7dc184a
treea2922b26cb00796bc077652177e6065f32e10c05
parent46bf97c534ca7e202f741d9f6ebe72f73f076302
c++: crash with anon VAR_DECL [PR116676]

r12-3495 added maybe_warn_about_constant_value which will crash if
it gets a nameless VAR_DECL, which is what happens in this PR.

We created this VAR_DECL in cp_parser_decomposition_declaration.

PR c++/116676

gcc/cp/ChangeLog:

* constexpr.cc (maybe_warn_about_constant_value): Check DECL_NAME.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/constexpr-116676.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit dfe0d4389a3ce43179563a63046ad3e74d615a08)
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1z/constexpr-116676.C [new file with mode: 0644]