diff options
author | Marek Polacek <polacek@redhat.com> | 2024-09-16 16:42:38 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-09-17 11:27:39 -0400 |
commit | dfe0d4389a3ce43179563a63046ad3e74d615a08 (patch) | |
tree | b1b10c5fe40f3b4d505014e02acbfba75c933b09 /gcc/cp | |
parent | e311dd13a9adbc51d56971cba06e1ff15a4256d2 (diff) | |
download | gcc-dfe0d4389a3ce43179563a63046ad3e74d615a08.zip gcc-dfe0d4389a3ce43179563a63046ad3e74d615a08.tar.gz gcc-dfe0d4389a3ce43179563a63046ad3e74d615a08.tar.bz2 |
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>
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/constexpr.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index d0f6174..c3668b0 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -7222,6 +7222,7 @@ maybe_warn_about_constant_value (location_t loc, tree decl) && warn_interference_size && !OPTION_SET_P (param_destruct_interfere_size) && DECL_CONTEXT (decl) == std_node + && DECL_NAME (decl) && id_equal (DECL_NAME (decl), "hardware_destructive_interference_size") && (LOCATION_FILE (input_location) != main_input_filename || module_exporting_p ()) |