Commit 42eaed49 by Nathan Sidwell Committed by Nathan Sidwell

cp-tree.h (enum tsubst_flags_t): Add tf_user.

	* cp-tree.h (enum tsubst_flags_t): Add tf_user.
	* decl.c (make_typename_type): Pass it.
	* pt.c (lookup_template_class): Use it.
	(resolve_typename_type): Pass it.
	* semantics.c (finish_template_type): Pass it.

From-SVN: r69793
parent e884d397
2003-07-25 Nathan Sidwell <nathan@codesourcery.com> 2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (enum tsubst_flags_t): Add tf_user.
* decl.c (make_typename_type): Pass it.
* pt.c (lookup_template_class): Use it.
(resolve_typename_type): Pass it.
* semantics.c (finish_template_type): Pass it.
2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11617 PR c++/11617
* cp-tree.h (qualified_name_lookup_error): Declare. * cp-tree.h (qualified_name_lookup_error): Declare.
* pt.c (tsubst_qualified_id): Use qualified_name_lookup_error for * pt.c (tsubst_qualified_id): Use qualified_name_lookup_error for
......
...@@ -3054,8 +3054,10 @@ typedef enum tsubst_flags_t { ...@@ -3054,8 +3054,10 @@ typedef enum tsubst_flags_t {
tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */ tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
tf_keep_type_decl = 1 << 3, /* retain typedef type decls tf_keep_type_decl = 1 << 3, /* retain typedef type decls
(make_typename_type use) */ (make_typename_type use) */
tf_ptrmem_ok = 1 << 4 /* pointers to member ok (internal tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
instantiate_type use) */ instantiate_type use) */
tf_user = 1 << 5 /* Found template must be a user template
(lookup_template_class use) */
} tsubst_flags_t; } tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */ /* The kind of checking we can do looking in a class hierarchy. */
......
...@@ -5523,7 +5523,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -5523,7 +5523,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
TREE_OPERAND (fullname, 1), TREE_OPERAND (fullname, 1),
NULL_TREE, context, NULL_TREE, context,
/*entering_scope=*/0, /*entering_scope=*/0,
tf_error | tf_warning); tf_error | tf_warning | tf_user);
} }
else else
{ {
......
...@@ -3957,8 +3957,11 @@ lookup_template_class (tree d1, ...@@ -3957,8 +3957,11 @@ lookup_template_class (tree d1,
{ {
tree template = NULL_TREE, parmlist; tree template = NULL_TREE, parmlist;
tree t; tree t;
timevar_push (TV_NAME_LOOKUP); timevar_push (TV_NAME_LOOKUP);
my_friendly_assert ((!arglist || TREE_CODE (arglist) == TREE_LIST)
== ((complain & tf_user) != 0), 20030724);
if (TREE_CODE (d1) == IDENTIFIER_NODE) if (TREE_CODE (d1) == IDENTIFIER_NODE)
{ {
if (IDENTIFIER_VALUE (d1) if (IDENTIFIER_VALUE (d1)
...@@ -4018,11 +4021,10 @@ lookup_template_class (tree d1, ...@@ -4018,11 +4021,10 @@ lookup_template_class (tree d1,
} }
if (TREE_CODE (template) != TEMPLATE_DECL if (TREE_CODE (template) != TEMPLATE_DECL
/* If we're called from the parser, make sure it's a user visible /* Make sure it's a user visible template, if it was named by
template. */ the user. */
|| ((!arglist || TREE_CODE (arglist) == TREE_LIST) || ((complain & tf_user) && !DECL_TEMPLATE_PARM_P (template)
&& !DECL_TEMPLATE_PARM_P (template) && !PRIMARY_TEMPLATE_P (template)))
&& !PRIMARY_TEMPLATE_P (template)))
{ {
if (complain & tf_error) if (complain & tf_error)
{ {
...@@ -4033,6 +4035,8 @@ lookup_template_class (tree d1, ...@@ -4033,6 +4035,8 @@ lookup_template_class (tree d1,
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
complain &= ~tf_user;
if (DECL_TEMPLATE_TEMPLATE_PARM_P (template)) if (DECL_TEMPLATE_TEMPLATE_PARM_P (template))
{ {
/* Create a new TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM node to store /* Create a new TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM node to store
...@@ -11795,8 +11799,7 @@ resolve_typename_type (tree type, bool only_current_p) ...@@ -11795,8 +11799,7 @@ resolve_typename_type (tree type, bool only_current_p)
args = TREE_OPERAND (TYPENAME_TYPE_FULLNAME (type), 1); args = TREE_OPERAND (TYPENAME_TYPE_FULLNAME (type), 1);
/* Instantiate the template. */ /* Instantiate the template. */
type = lookup_template_class (tmpl, args, NULL_TREE, NULL_TREE, type = lookup_template_class (tmpl, args, NULL_TREE, NULL_TREE,
/*entering_scope=*/0, /*entering_scope=*/0, tf_error | tf_user);
tf_error);
} }
else else
type = error_mark_node; type = error_mark_node;
......
...@@ -2183,8 +2183,8 @@ finish_template_type (tree name, tree args, int entering_scope) ...@@ -2183,8 +2183,8 @@ finish_template_type (tree name, tree args, int entering_scope)
tree decl; tree decl;
decl = lookup_template_class (name, args, decl = lookup_template_class (name, args,
NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, entering_scope,
entering_scope, /*complain=*/1); tf_error | tf_warning | tf_user);
if (decl != error_mark_node) if (decl != error_mark_node)
decl = TYPE_STUB_DECL (decl); decl = TYPE_STUB_DECL (decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment