/* Handle parameterized types (templates) for GNU C++.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+ 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
val = iterative_hash_template_arg (TREE_TYPE (arg), val);
return iterative_hash_template_arg (TYPE_DOMAIN (arg), val);
- case LAMBDA_EXPR:
- /* A lambda can't appear in a template arg, but don't crash on
- erroneous input. */
- gcc_assert (errorcount > 0);
- return val;
-
default:
switch (tclass)
{
int nargs = TREE_VEC_LENGTH (inner_args);
int ntparms;
int i;
- bool did_error_intro = false;
+ int did_error_intro = 0;
struct template_parm_data tpd;
struct template_parm_data tpd2;
if (!did_error_intro)
{
error ("template parameters not used in partial specialization:");
- did_error_intro = true;
+ did_error_intro = 1;
}
error (" %qD", TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));
}
- if (did_error_intro)
- return error_mark_node;
-
/* [temp.class.spec]
The argument list of the specialization shall not be identical to
if (error_operand_p (expr))
return error_mark_node;
expr_type = TREE_TYPE (expr);
- expr = mark_rvalue_use (expr);
/* HACK: Due to double coercion, we can get a
NOP_EXPR<REFERENCE_TYPE>(ADDR_EXPR<POINTER_TYPE> (arg)) here,
DECL_TEMPLATE_INFO (old_decl) = new_friend_template_info;
if (TREE_CODE (old_decl) != TEMPLATE_DECL)
- {
- /* We should have called reregister_specialization in
- duplicate_decls. */
- gcc_assert (retrieve_specialization (new_template,
- new_args, 0)
- == old_decl);
-
- /* Instantiate it if the global has already been used. */
- if (DECL_ODR_USED (old_decl))
- instantiate_decl (old_decl, /*defer_ok=*/true,
- /*expl_inst_class_mem_p=*/false);
- }
+ /* We should have called reregister_specialization in
+ duplicate_decls. */
+ gcc_assert (retrieve_specialization (new_template,
+ new_args, 0)
+ == old_decl);
else
{
tree t;
type = DECL_ORIGINAL_TYPE (t);
else
type = TREE_TYPE (t);
- if (TREE_CODE (t) == VAR_DECL && VAR_HAD_UNKNOWN_BOUND (t))
- type = strip_array_domain (type);
type = tsubst (type, args, complain, in_decl);
}
if (TREE_CODE (r) == VAR_DECL)
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt)
{
int elt_strict = strict;
-
- if (elt == error_mark_node)
- return 1;
-
if (!BRACE_ENCLOSED_INITIALIZER_P (elt))
{
tree type = TREE_TYPE (elt);
tree parms = TREE_VALUE (t);
partial_spec_args = CLASSTYPE_TI_ARGS (TREE_TYPE (t));
-
- ++processing_template_decl;
-
if (outer_args)
{
int i;
+ ++processing_template_decl;
+
/* Discard the outer levels of args, and then substitute in the
template args from the enclosing class. */
partial_spec_args = INNERMOST_TEMPLATE_ARGS (partial_spec_args);
TREE_VEC_ELT (parms, i) =
tsubst (TREE_VEC_ELT (parms, i), outer_args, tf_none, NULL_TREE);
+ --processing_template_decl;
}
partial_spec_args =
/*require_all_args=*/true,
/*use_default_args=*/true);
- --processing_template_decl;
-
if (partial_spec_args == error_mark_node)
return error_mark_node;
DECL_DECLARED_INLINE_P (decl) = 1;
}
else if (TREE_CODE (decl) == VAR_DECL)
- {
- DECL_INITIAL (decl) =
- tsubst_expr (DECL_INITIAL (code_pattern), args,
- tf_error, DECL_TI_TEMPLATE (decl),
- /*integral_constant_expression_p=*/false);
- if (VAR_HAD_UNKNOWN_BOUND (decl))
- TREE_TYPE (decl) = tsubst (TREE_TYPE (code_pattern), args,
- tf_error, DECL_TI_TEMPLATE (decl));
- }
+ DECL_INITIAL (decl) =
+ tsubst_expr (DECL_INITIAL (code_pattern), args,
+ tf_error, DECL_TI_TEMPLATE (decl),
+ /*integral_constant_expression_p=*/false);
else
gcc_unreachable ();
return false;
}
- /* A static data member of the current instantiation with incomplete
- array type is type-dependent, as the definition and specializations
- can have different bounds. */
- if (TREE_CODE (expression) == VAR_DECL
- && DECL_CLASS_SCOPE_P (expression)
- && dependent_type_p (DECL_CONTEXT (expression))
- && VAR_HAD_UNKNOWN_BOUND (expression))
- return true;
-
if (TREE_TYPE (expression) == unknown_type_node)
{
if (TREE_CODE (expression) == ADDR_EXPR)