FreeBSD/contrib/gcc/cp/decl.c
/* Returns the kind of template specialization we are currently
   processing, given that it's declaration contained N_CLASS_SCOPES
   explicit scope qualifications.  */
Returns the kind of template specialization we are currently
processing, given that it's declaration contained N_CLASS_SCOPES
explicit scope qualifications.
Returns the kind of template specialization we are currently processing given that it ' s declaration contained N_CLASS_SCOPES explicit scope qualifications .
tmpl_spec_kind
current_tmpl_spec_kind (int n_class_scopes)
{
  int n_template_parm_scopes = 0;
  int seen_specialization_p = 0;
  int innermost_specialization_p = 0;
  struct cp_binding_level *b;
  for (b = current_binding_level;
       b->kind == sk_template_parms;
       b = b->level_chain)
    {
      if (b->explicit_spec_p)
	{
	  if (n_template_parm_scopes == 0)
	    innermost_specialization_p = 1;
	  else
	    seen_specialization_p = 1;
	}
      else if (seen_specialization_p == 1)
	return tsk_invalid_member_spec;
      ++n_template_parm_scopes;
    }
  if (processing_explicit_instantiation)
    {
      if (n_template_parm_scopes != 0)
	return tsk_invalid_expl_inst;
      else
	return tsk_expl_inst;
    }
  if (n_template_parm_scopes < n_class_scopes)
    return tsk_insufficient_parms;
  else if (n_template_parm_scopes == n_class_scopes)
    return tsk_none;
  else if (n_template_parm_scopes > n_class_scopes + 1)
    return tsk_excessive_parms;
  else
    return innermost_specialization_p ? tsk_expl_spec : tsk_template;
}
tmpl_spec_kind current_tmpl_spec_kind ( int n_class_scopes ) { int n_template_parm_scopes = 0 ; int seen_specialization_p = 0 ; int innermost_specialization_p = 0 ; struct cp_binding_level * b ; for ( b = current_binding_level ; b -> kind == sk_template_parms ; b = b -> level_chain ) { if ( b -> explicit_spec_p ) { if ( n_template_parm_scopes == 0 ) innermost_specialization_p = 1 ; else seen_specialization_p = 1 ; } else if ( seen_specialization_p == 1 ) return tsk_invalid_member_spec ; ++ n_template_parm_scopes ; } if ( processing_explicit_instantiation ) { if ( n_template_parm_scopes != 0 ) return tsk_invalid_expl_inst ; else return tsk_expl_inst ; } if ( n_template_parm_scopes < n_class_scopes ) return tsk_insufficient_parms ; else if ( n_template_parm_scopes == n_class_scopes ) return tsk_none ; else if ( n_template_parm_scopes > n_class_scopes + 1 ) return tsk_excessive_parms ; else return innermost_specialization_p ? tsk_expl_spec : tsk_template ; }
Returns the kind of template specialization we are currently
processing, given that it's declaration contained N_CLASS_SCOPES
explicit scope qualifications.
Returns the kind of template specialization we are currently processing given that it ' s declaration contained N_CLASS_SCOPES explicit scope qualifications .
/* Scan through the template parameter scopes.  */ /* If we see a specialization scope inside a parameter scope,
	 then something is wrong.  That corresponds to a declaration
	 like:

	    template <class T> template <> ...

	 which is always invalid since [temp.expl.spec] forbids the
	 specialization of a class member template if the enclosing
	 class templates are not explicitly specialized as well.  */ /* Handle explicit instantiations.  */ /* We've seen a template parameter list during an explicit
	   instantiation.  For example:

	     template <class T> template void f(int);

	   This is erroneous.  */ /* We've not seen enough template headers to match all the
       specialized classes present.  For example:

	 template <class T> void R<T>::S<T>::f(int);

       This is invalid; there needs to be one set of template
       parameters for each class.  */ /* We're processing a non-template declaration (even though it may
       be a member of a template class.)  For example:

	 template <class T> void S<T>::f(int);

       The `class T' maches the `S<T>', leaving no template headers
       corresponding to the `f'.  */ /* We've got too many template headers.  For example:

	 template <> template <class T> void f (T);

       There need to be more enclosing classes.  */ /* This must be a template.  It's of the form:

	 template <class T> template <class U> void S<T>::f(U);

       This is a specialization if the innermost level was a
       specialization; otherwise it's just a definition of the
       template.  */