c++: Relax new assert [PR 97905]

It turns out there are legitimate cases for the new decl to not have
lang-specific.

	PR c++/97905
	gcc/cp/
	* decl.c (duplicate_decls): Relax new assert.
	gcc/testsuite/
	* g++.dg/lookup/pr97905.C: New.
This commit is contained in:
Nathan Sidwell 2020-11-19 08:00:49 -08:00
parent 5ace1776b8
commit 255483e5b7
2 changed files with 9 additions and 3 deletions

View file

@ -2749,9 +2749,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
with that from NEWDECL below. */
if (DECL_LANG_SPECIFIC (olddecl))
{
gcc_checking_assert (DECL_LANG_SPECIFIC (newdecl)
&& (DECL_LANG_SPECIFIC (olddecl)
!= DECL_LANG_SPECIFIC (newdecl)));
gcc_checking_assert (DECL_LANG_SPECIFIC (olddecl)
!= DECL_LANG_SPECIFIC (newdecl));
ggc_free (DECL_LANG_SPECIFIC (olddecl));
}

View file

@ -0,0 +1,7 @@
// PR 97905
template <typename> void a() {
extern int *b; // This decl gets an (unneeded) decl-lang-specific
}
int *b; // this does not