https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99120
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:c7d7c15540d5173f76b570bd457e866f09a17722 commit r10-9686-gc7d7c15540d5173f76b570bd457e866f09a17722 Author: Marek Polacek <pola...@redhat.com> Date: Fri Mar 5 10:41:41 2021 -0500 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. (cherry picked from commit c2e64c33d9d903f0a52565ad98300feea0ffc580)