summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-25 16:45:34 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-25 16:45:34 +0000
commitb992fe70b8c774f09f88b8f872775e5cdeb853b9 (patch)
tree5ce31364e9c54f69c348f58b432c5b909c19ff2b /gcc/cp
parentc540e815225b2c1693eb37600b6cb4bac71df23e (diff)
downloadgcc-b992fe70b8c774f09f88b8f872775e5cdeb853b9.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/cp-tree.h6
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/pt.c19
-rw-r--r--gcc/cp/semantics.c4
5 files changed, 26 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0ae6496ba8a..e163f2360ed 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,13 @@
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
* cp-tree.h (qualified_name_lookup_error): Declare.
* pt.c (tsubst_qualified_id): Use qualified_name_lookup_error for
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 994298a061c..eb7933687c8 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3054,8 +3054,10 @@ typedef enum tsubst_flags_t {
tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
tf_keep_type_decl = 1 << 3, /* retain typedef type decls
(make_typename_type use) */
- tf_ptrmem_ok = 1 << 4 /* pointers to member ok (internal
- instantiate_type use) */
+ tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
+ instantiate_type use) */
+ tf_user = 1 << 5 /* Found template must be a user template
+ (lookup_template_class use) */
} tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index cec42f37770..27cb784913a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5523,7 +5523,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
TREE_OPERAND (fullname, 1),
NULL_TREE, context,
/*entering_scope=*/0,
- tf_error | tf_warning);
+ tf_error | tf_warning | tf_user);
}
else
{
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 24c07bbdb24..66703723178 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3957,8 +3957,11 @@ lookup_template_class (tree d1,
{
tree template = NULL_TREE, parmlist;
tree t;
-
+
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 (IDENTIFIER_VALUE (d1)
@@ -4018,11 +4021,10 @@ lookup_template_class (tree d1,
}
if (TREE_CODE (template) != TEMPLATE_DECL
- /* If we're called from the parser, make sure it's a user visible
- template. */
- || ((!arglist || TREE_CODE (arglist) == TREE_LIST)
- && !DECL_TEMPLATE_PARM_P (template)
- && !PRIMARY_TEMPLATE_P (template)))
+ /* Make sure it's a user visible template, if it was named by
+ the user. */
+ || ((complain & tf_user) && !DECL_TEMPLATE_PARM_P (template)
+ && !PRIMARY_TEMPLATE_P (template)))
{
if (complain & tf_error)
{
@@ -4033,6 +4035,8 @@ lookup_template_class (tree d1,
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
+ complain &= ~tf_user;
+
if (DECL_TEMPLATE_TEMPLATE_PARM_P (template))
{
/* 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)
args = TREE_OPERAND (TYPENAME_TYPE_FULLNAME (type), 1);
/* Instantiate the template. */
type = lookup_template_class (tmpl, args, NULL_TREE, NULL_TREE,
- /*entering_scope=*/0,
- tf_error);
+ /*entering_scope=*/0, tf_error | tf_user);
}
else
type = error_mark_node;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 50c74780daf..da34da29333 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2183,8 +2183,8 @@ finish_template_type (tree name, tree args, int entering_scope)
tree decl;
decl = lookup_template_class (name, args,
- NULL_TREE, NULL_TREE,
- entering_scope, /*complain=*/1);
+ NULL_TREE, NULL_TREE, entering_scope,
+ tf_error | tf_warning | tf_user);
if (decl != error_mark_node)
decl = TYPE_STUB_DECL (decl);