summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-15 16:56:50 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-15 16:56:50 +0000
commita6c5183356088843004ce3270cbde684b95cdd89 (patch)
tree0c39820a8b3af2c64ee768e07e5251679c5d333a /gcc
parent9c393d679ebf4f37144d2168b9331fc58cbd54d6 (diff)
downloadgcc-a6c5183356088843004ce3270cbde684b95cdd89.tar.gz
* decl2.c (arg_assoc_type): Handle METHOD_TYPE like FUNCTION_TYPE.
Handle TEMPLATE_TYPE_PARM. (arg_assoc): Rewrite. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21199 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c100
2 files changed, 35 insertions, 71 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dbbe414f5ea..1425f4b336e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,7 +1,11 @@
1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (arg_assoc_type): Handle METHOD_TYPE like FUNCTION_TYPE.
+ Handle TEMPLATE_TYPE_PARM.
+ (arg_assoc): Rewrite.
+
* pt.c (complete_template_args): Don't look at the context unless
- we have too.
+ we have to.
* method.c (build_decl_overload_real): Fix namespace handling.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 1a88ef7899f..9570bc0393c 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4140,7 +4140,8 @@ struct arg_lookup
static int arg_assoc PROTO((struct arg_lookup*, tree));
static int arg_assoc_args PROTO((struct arg_lookup*, tree));
-/* Add a function to the lookup structure. */
+/* Add a function to the lookup structure.
+ Returns 1 on error. */
static int
add_function (k, fn)
@@ -4172,7 +4173,8 @@ add_function (k, fn)
return 0;
}
-/* Add functions of a namespace to the lookup structure. */
+/* Add functions of a namespace to the lookup structure.
+ Returns 1 on error. */
static int
arg_assoc_namespace (k, scope)
@@ -4196,7 +4198,8 @@ arg_assoc_namespace (k, scope)
return 0;
}
-/* Adds everything associated with class to the lookup structure. */
+/* Adds everything associated with class to the lookup structure.
+ Returns 1 on error. */
static int
arg_assoc_class (k, type)
@@ -4234,7 +4237,8 @@ arg_assoc_class (k, type)
return 0;
}
-/* Adds everything associated with a given type. */
+/* Adds everything associated with a given type.
+ Returns 1 on error. */
static int
arg_assoc_type (k, type)
@@ -4267,16 +4271,16 @@ arg_assoc_type (k, type)
return 1;
return arg_assoc_type (k, TREE_TYPE (type));
case METHOD_TYPE:
- /* Associate the class of the method. */
- if (arg_assoc_type (k, TYPE_METHOD_BASETYPE (type)))
- return 1;
- /* Fall through. */
+ /* The basetype is referenced in the first arg type, so just
+ fall through. */
case FUNCTION_TYPE:
/* Associate the parameter types. */
if (arg_assoc_args (k, TYPE_ARG_TYPES (type)))
return 1;
/* Associate the return type. */
return arg_assoc_type (k, TREE_TYPE (type));
+ case TEMPLATE_TYPE_PARM:
+ return 0;
case LANG_TYPE:
if (type == unknown_type_node)
return 0;
@@ -4287,7 +4291,7 @@ arg_assoc_type (k, type)
return 0;
}
-/* Adds everything associated with arguments. */
+/* Adds everything associated with arguments. Returns 1 on error. */
static int
arg_assoc_args (k, args)
@@ -4300,74 +4304,30 @@ arg_assoc_args (k, args)
return 0;
}
-/* Adds everything associated with a given tree_node. */
+/* Adds everything associated with a given tree_node. Returns 1 on error. */
static int
arg_assoc (k, n)
struct arg_lookup* k;
tree n;
{
- switch (TREE_CODE_CLASS (TREE_CODE (n)))
- {
- case 't':
- return arg_assoc_type (k, n);
- case 'c':
- case '1':
- case '2':
- case '<':
- case 'r':
- return arg_assoc_type (k, TREE_TYPE (n));
- case 'e':
- switch (TREE_CODE (n))
- {
- case ADDR_EXPR:
- /* special processing */
- break;
- default:
- return arg_assoc_type (k, TREE_TYPE (n));
- }
- default:
- break;
- }
+ if (TREE_CODE_CLASS (TREE_CODE (n)) == 't')
+ return arg_assoc_type (k, n);
+
+ if (! type_unknown_p (n))
+ return arg_assoc_type (k, TREE_TYPE (n));
+
+ if (TREE_CODE (n) == ADDR_EXPR)
+ n = TREE_OPERAND (n, 0);
+ if (TREE_CODE (n) == TREE_LIST)
+ n = TREE_VALUE (n);
+
+ my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);
+
+ for (; n; n = TREE_CHAIN (n))
+ if (arg_assoc (k, OVL_FUNCTION (n)))
+ return 1;
- while (n)
- switch (TREE_CODE (n))
- {
- case CONST_DECL: /* 'd' */
- case VAR_DECL:
- case PARM_DECL:
- case RESULT_DECL:
- return arg_assoc_type (k, TREE_TYPE (n));
- case ADDR_EXPR: /* 'e' */
- /* We can't use the TREE_TYPE, as the type of an overloaded function
- will be useless here. */
- n = TREE_OPERAND (n, 0);
- continue;
- case OVERLOAD: /* 'x' */
- if (arg_assoc (k, OVL_CURRENT (n)))
- return 1;
- n = OVL_NEXT (n);
- continue;
- case TREE_LIST: /* 'x' */
- /* XXX Overloaded member, should get an OVERLOAD directly, here. */
- n = TREE_VALUE (n);
- continue;
- case FUNCTION_DECL: /* 'd' */
- if (arg_assoc_args (k, TYPE_ARG_TYPES (TREE_TYPE (n))))
- return 1;
- return 0;
- case TEMPLATE_DECL:
- /* XXX Type of a function template in the context of Koenig lookup?
- Assume that template parameters are non-deduced for the moment. */
- n = DECL_RESULT (n);
- continue;
- case ERROR_MARK:
- return 0;
- default:
- cp_error ("sorry, Koenig lookup for `%s' of type `%T' failed",
- tree_code_name [(int)TREE_CODE (n)], TREE_TYPE (n));
- my_friendly_abort (391);
- }
return 0;
}