FreeBSD/contrib/gcc/cp/typeck.c
/* An expression of the form "A::template B" has been resolved to
   DECL.  Issue a diagnostic if B is not a template or template
   specialization.  */
An expression of the form "A::template B" has been resolved to
DECL.  Issue a diagnostic if B is not a template or template
specialization.
An expression of the form " A :: template B " has been resolved to DECL . Issue a diagnostic if B is not a template or template specialization .
void
check_template_keyword (tree decl)
{
  if (TREE_CODE (decl) != TEMPLATE_DECL
      && TREE_CODE (decl) != TEMPLATE_ID_EXPR)
    {
      if (!is_overloaded_fn (decl))
	pedwarn ("%qD is not a template", decl);
      else
	{
	  tree fns;
	  fns = decl;
	  if (BASELINK_P (fns))
	    fns = BASELINK_FUNCTIONS (fns);
	  while (fns)
	    {
	      tree fn = OVL_CURRENT (fns);
	      if (TREE_CODE (fn) == TEMPLATE_DECL
		  || TREE_CODE (fn) == TEMPLATE_ID_EXPR)
		break;
	      if (TREE_CODE (fn) == FUNCTION_DECL
		  && DECL_USE_TEMPLATE (fn)
		  && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (fn)))
		break;
	      fns = OVL_NEXT (fns);
	    }
	  if (!fns)
	    pedwarn ("%qD is not a template", decl);
	}
    }
}
void check_template_keyword ( tree decl ) { if ( TREE_CODE ( decl ) != TEMPLATE_DECL && TREE_CODE ( decl ) != TEMPLATE_ID_EXPR ) { if ( ! is_overloaded_fn ( decl ) ) pedwarn ( " " , decl ) ; else { tree fns ; fns = decl ; if ( BASELINK_P ( fns ) ) fns = BASELINK_FUNCTIONS ( fns ) ; while ( fns ) { tree fn = OVL_CURRENT ( fns ) ; if ( TREE_CODE ( fn ) == TEMPLATE_DECL || TREE_CODE ( fn ) == TEMPLATE_ID_EXPR ) break ; if ( TREE_CODE ( fn ) == FUNCTION_DECL && DECL_USE_TEMPLATE ( fn ) && PRIMARY_TEMPLATE_P ( DECL_TI_TEMPLATE ( fn ) ) ) break ; fns = OVL_NEXT ( fns ) ; } if ( ! fns ) pedwarn ( " " , decl ) ; } } }
An expression of the form "A::template B" has been resolved to
DECL.
An expression of the form " A :: template B " has been resolved to DECL .
/* The standard says:

      [temp.names]

      If a name prefixed by the keyword template is not a member
      template, the program is ill-formed.

     DR 228 removed the restriction that the template be a member
     template.

     DR 96, if accepted would add the further restriction that explicit
     template arguments must be provided if the template keyword is
     used, but, as of 2005-10-16, that DR is still in "drafting".  If
     this DR is accepted, then the semantic checks here can be
     simplified, as the entity named must in fact be a template
     specialization, rather than, as at present, a set of overloaded
     functions containing at least one template function.  */