c++: Stop (most) function-scope entities having a template header
Currently push_template_decl (mostly) decides whether to add a
template header to an entity by seeing if it has DECL_LANG_SPECIFIC.
That might have been a useful predicate at one time, but basing
semantic implications on how we've decided to represent decls is bound
to be brittle. And indeed it is, as more decls grow a use for
lang-specific. In particular I discovered that function-scope
VAR_DECLs couild grow lang-specific, and thereby get a template
header. There's no need for that, and it breaks an invariant modules
was expected.
This patch changes that, and bases the descision on the properties of
the decl. In particular the only function-scope decl that gets a
template header is an implicit-typedef.
I also cleaned up the behaviour of it building a template-info only to
ignore it.
gcc/cp/
* pt.c (push_template_decl): Do not give function-scope entities
other than implicit typedefs a template header. Do not readd
template info to a redeclared template.