returning an int. */
typedef int (*tree_fn_t) (tree, void*);
-/* The PENDING_TEMPLATES is a TREE_LIST of templates whose
- instantiations have been deferred, either because their definitions
- were not yet available, or because we were putting off doing the work. */
+/* The PENDING_TEMPLATES is a list of templates whose instantiations
+ have been deferred, either because their definitions were not yet
+ available, or because we were putting off doing the work. */
struct GTY ((chain_next ("%h.next"))) pending_template
{
struct pending_template *next;
static bool equal (spec_entry *, spec_entry *);
};
-static GTY (()) hash_table<spec_hasher> *decl_specializations;
-
-static GTY (()) hash_table<spec_hasher> *type_specializations;
+/* The general template is not in these tables. */
+typedef hash_table<spec_hasher> spec_hash_table;
+static GTY (()) spec_hash_table *decl_specializations;
+static GTY (()) spec_hash_table *type_specializations;
/* Contains canonical template parameter types. The vector is indexed by
the TEMPLATE_TYPE_IDX of the template parameter. Each element is a
{
spec_entry *found;
spec_entry elt;
- hash_table<spec_hasher> *specializations;
+ spec_hash_table *specializations;
elt.tmpl = tmpl;
elt.args = args;
if (hash == 0)
hash = spec_hasher::hash (&elt);
- slot =
- decl_specializations->find_slot_with_hash (&elt, hash, INSERT);
+ slot = decl_specializations->find_slot_with_hash (&elt, hash, INSERT);
if (*slot)
- fn = ((spec_entry *) *slot)->spec;
+ fn = (*slot)->spec;
else
fn = NULL_TREE;
}
TEMPLATE_PARM_PARAMETER_PACK (tpi)
= TEMPLATE_PARM_PARAMETER_PACK (index);
- /* Template template parameters need this. */
+ /* Template template parameters need this. */
tree inner = decl;
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
template <typename T> friend void A<T>::f();
is not primary. */
is_primary = false;
- else if (TREE_CODE (decl) == TYPE_DECL
- && LAMBDA_TYPE_P (TREE_TYPE (decl)))
+ else if (TREE_CODE (decl) == TYPE_DECL && LAMBDA_TYPE_P (TREE_TYPE (decl)))
is_primary = false;
else
is_primary = template_parm_scope_p ();
if (!ctx
|| TREE_CODE (ctx) == FUNCTION_DECL
|| (CLASS_TYPE_P (ctx) && TYPE_BEING_DEFINED (ctx))
- || (TREE_CODE (decl) == TYPE_DECL
- && LAMBDA_TYPE_P (TREE_TYPE (decl)))
+ || (TREE_CODE (decl) == TYPE_DECL && LAMBDA_TYPE_P (TREE_TYPE (decl)))
|| (is_friend && !DECL_TEMPLATE_INFO (decl)))
{
if (DECL_LANG_SPECIFIC (decl)
continue;
/* Build new CLASSTYPE_NESTED_UTDS. */
+ bool class_template_p = (TREE_CODE (t) != ENUMERAL_TYPE
+ && TYPE_LANG_SPECIFIC (t)
+ && CLASSTYPE_IS_TEMPLATE (t));
- tree newtag;
- bool class_template_p;
-
- class_template_p = (TREE_CODE (t) != ENUMERAL_TYPE
- && TYPE_LANG_SPECIFIC (t)
- && CLASSTYPE_IS_TEMPLATE (t));
/* If the member is a class template, then -- even after
substitution -- there may be dependent types in the
template argument list for the class. We increment
when outside of a template. */
if (class_template_p)
++processing_template_decl;
- newtag = tsubst (t, args, tf_error, NULL_TREE);
+ tree newtag = tsubst (t, args, tf_error, NULL_TREE);
if (class_template_p)
--processing_template_decl;
if (newtag == error_mark_node)
tree vec = NULL_TREE;
int len = 1;
+ gcc_checking_assert (TREE_CODE (t) != CONST_DECL);
/* The file and line for this declaration, to
assist in error message reporting. Since we
called push_tinst_level above, we don't need to
make_argument_pack (tree vec)
{
tree pack;
- tree elt = TREE_VEC_ELT (vec, 0);
- if (TYPE_P (elt))
+
+ if (TYPE_P (TREE_VEC_ELT (vec, 0)))
pack = cxx_make_type (TYPE_ARGUMENT_PACK);
else
{
but it doesn't seem to be on the hot path. */
spec = retrieve_specialization (gen_tmpl, targ_ptr, 0);
- gcc_assert (tmpl == gen_tmpl
- || ((fndecl = retrieve_specialization (tmpl, orig_args, 0))
- == spec)
- || fndecl == NULL_TREE);
+ gcc_checking_assert (tmpl == gen_tmpl
+ || ((fndecl
+ = retrieve_specialization (tmpl, orig_args, 0))
+ == spec)
+ || fndecl == NULL_TREE);
if (spec != NULL_TREE)
{
TREE_CONSTANT (result) = 1;
}
else
- result = cxx_make_type (TYPE_ARGUMENT_PACK);
+ result = cxx_make_type (TYPE_ARGUMENT_PACK);
SET_ARGUMENT_PACK_ARGS (result, new_args);
gen_tmpl = most_general_template (tmpl);
gen_args = DECL_TI_ARGS (d);
- if (tmpl != gen_tmpl)
- /* We should already have the extra args. */
- gcc_assert (TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (gen_tmpl))
- == TMPL_ARGS_DEPTH (gen_args));
+ /* We should already have the extra args. */
+ gcc_checking_assert (tmpl == gen_tmpl
+ || (TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (gen_tmpl))
+ == TMPL_ARGS_DEPTH (gen_args)));
/* And what's in the hash table should match D. */
- gcc_assert ((spec = retrieve_specialization (gen_tmpl, gen_args, 0)) == d
- || spec == NULL_TREE);
+ gcc_checking_assert ((spec = retrieve_specialization (gen_tmpl, gen_args, 0))
+ == d
+ || spec == NULL_TREE);
/* This needs to happen before any tsubsting. */
if (! push_tinst_level (d))
gcc_checking_assert (uses_template_parms (scope));
/* Usually the non-qualified identifier of a TYPENAME_TYPE is
- TYPE_IDENTIFIER (type). But when 'type' is a typedef variant of
- a TYPENAME_TYPE node, then TYPE_NAME (type) is set to the TYPE_DECL representing
- the typedef. In that case TYPE_IDENTIFIER (type) is not the non-qualified
- identifier of the TYPENAME_TYPE anymore.
- So by getting the TYPE_IDENTIFIER of the _main declaration_ of the
- TYPENAME_TYPE instead, we avoid messing up with a possible
+ TYPE_IDENTIFIER (type). But when 'type' is a typedef variant of a
+ TYPENAME_TYPE node, then TYPE_NAME (type) is set to the TYPE_DECL
+ representing the typedef. In that case TYPE_IDENTIFIER (type) is
+ not the non-qualified identifier of the TYPENAME_TYPE anymore.
+ So by getting the TYPE_IDENTIFIER of the _main declaration_ of
+ the TYPENAME_TYPE instead, we avoid messing up with a possible
typedef variant case. */
name = TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (type));
return error_mark_node;
}
- /* Initially build the concept declaration; it's type is bool. */
+ /* Initially build the concept declaration; its type is bool. */
tree decl = build_lang_decl_loc (loc, CONCEPT_DECL, *id, boolean_type_node);
DECL_CONTEXT (decl) = current_scope ();
DECL_INITIAL (decl) = init;