https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97877
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathan Sidwell <nat...@gcc.gnu.org>: https://gcc.gnu.org/g:e0da4aed176a8de042a8482beb65499e29448556 commit r11-5108-ge0da4aed176a8de042a8482beb65499e29448556 Author: Nathan Sidwell <nat...@acm.org> Date: Tue Nov 17 13:16:47 2020 -0800 c++: duplicate block-scope extern [PR 97877] We ICED with a duplicated block-scope extern, as duplicate_decls was dropping the decl_lang_specific of olddecl. Simplys adding appropriate retrofitting and copying turned out to be insufficient because you can get a block-scope using decl also matching the extern. The latter seems a little suspicious and I have asked CWG for advice. While there robustified the assert about releasing olddecls' lang-specific -- if it had one, the new decl better have one. PR c++/97877 gcc/cp/ * decl.c (duplicate_decls): Deal with duplicated DECL_LOCAL_DECL_P decls. Extend decl_lang_specific checking assert. gcc/testsuite/ * g++.dg/lookup/pr97877.C: New.