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.
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));
}
--- /dev/null
+// PR 97905
+
+
+template <typename> void a() {
+ extern int *b; // This decl gets an (unneeded) decl-lang-specific
+}
+int *b; // this does not