]> 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 15:27:39 +0000 (11:27 -0400)
commitdfe0d4389a3ce43179563a63046ad3e74d615a08
treeb1b10c5fe40f3b4d505014e02acbfba75c933b09
parente311dd13a9adbc51d56971cba06e1ff15a4256d2
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>
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1z/constexpr-116676.C [new file with mode: 0644]