]> gcc.gnu.org Git - gcc.git/commit
c++: Fix ICE in check_local_shadow with enum [PR95560]
authorMarek Polacek <polacek@redhat.com>
Thu, 11 Jun 2020 21:58:21 +0000 (17:58 -0400)
committerMarek Polacek <polacek@redhat.com>
Thu, 11 Jun 2020 21:58:21 +0000 (17:58 -0400)
commit02f6c5b711b8188c3f49a79c730911b0bd216585
treef947de75f2106500691c01f707a33f6f776360b4
parentf2db0516e1ad6e1c08ed36b14920422f7699c153
c++: Fix ICE in check_local_shadow with enum [PR95560]

Another indication that perhaps this warning is emitted too early.  We
crash because same_type_p gets a null type: we have an enumerator
without a fixed underlying type and finish_enum_value_list hasn't yet
run.  So check if the type is null before calling same_type_p.

PR c++/95560
* name-lookup.c (check_local_shadow): Check if types are
non-null before calling same_type_p.

* g++.dg/warn/Wshadow-compatible-local-3.C: New test.
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/warn/Wshadow-compatible-local-3.C [new file with mode: 0644]
This page took 0.059659 seconds and 5 git commands to generate.