]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: ICE with -Wshadow and enumerator in template [PR99120]
authorMarek Polacek <polacek@redhat.com>
Fri, 5 Mar 2021 15:41:41 +0000 (10:41 -0500)
committerMarek Polacek <polacek@redhat.com>
Fri, 5 Mar 2021 22:55:27 +0000 (17:55 -0500)
commitc2e64c33d9d903f0a52565ad98300feea0ffc580
tree81dede6337af8e7772e952f567d32f2c6c427025
parent812230c63c3efcf2cb36965fe178420b5f1892a6
c++: ICE with -Wshadow and enumerator in template [PR99120]

We crash here, because in a template, an enumerator doesn't have
a type until we've called finish_enum_value_list.  But our -Wshadow
implementation, check_local_shadow, is called when we pushdecl in
build_enumerator, which takes place before finish_enum_value_list.

gcc/cp/ChangeLog:

PR c++/99120
* name-lookup.c (check_local_shadow): Check if the type of decl
is non-null before checking TYPE_PTR*.

gcc/testsuite/ChangeLog:

PR c++/99120
* g++.dg/warn/Wshadow-17.C: New test.
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/warn/Wshadow-17.C [new file with mode: 0644]