aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-07-16 00:16:25 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-07-15 20:16:25 -0400
commit00dc6358535b933b6d1d4a3773ee1c0081c36bd5 (patch)
tree148abff06e7e9fb026243a36003f513ed572239d /gcc
parente3a038596392fda6f5ddf2f308c2ad568359ae57 (diff)
downloadgcc-00dc6358535b933b6d1d4a3773ee1c0081c36bd5.zip
gcc-00dc6358535b933b6d1d4a3773ee1c0081c36bd5.tar.gz
gcc-00dc6358535b933b6d1d4a3773ee1c0081c36bd5.tar.bz2
decl2.c (arg_assoc_class): Also look at template arguments, if any.
* decl2.c (arg_assoc_class): Also look at template arguments, if any. (arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST. * lex.c (looking_for_typename): Don't initialize. * decl2.c (ambiguous_decl): Clarify error message. * decl.c (push_using_directive): Iterate over namespaces used indirectly. From-SVN: r21205
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/cp/decl2.c20
-rw-r--r--gcc/cp/lex.c2
4 files changed, 36 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 00ee76a..37a85a7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (arg_assoc_class): Also look at template arguments, if any.
+ (arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST.
+
+ * lex.c (looking_for_typename): Don't initialize.
+
+ * decl2.c (ambiguous_decl): Clarify error message.
+
+ * decl.c (push_using_directive): Iterate over namespaces used
+ indirectly.
+
1998-07-15 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* decl2.c (add_using_namespace): Iterate over namespaces used
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 10b64bc..e3f226c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3856,11 +3856,17 @@ push_using_directive (used, ancestor)
tree ancestor;
{
tree ud = current_binding_level->using_directives;
+ tree iter;
/* Check if we already have this. */
if (purpose_member (used, ud) != NULL_TREE)
return NULL_TREE;
-
+
+ /* Recursively add all namespaces used. */
+ for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
+ push_using_directive (TREE_PURPOSE (iter), ancestor);
+
+ ud = current_binding_level->using_directives;
ud = perm_tree_cons (used, ancestor, ud);
current_binding_level->using_directives = ud;
return ud;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index fb09e8c..2e8d569 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3937,9 +3937,9 @@ ambiguous_decl (name, old, new)
else
{
/* Some declarations are functions, some are not. */
- cp_error ("ambiguous definition `%D' used", name);
- cp_error_at ("first definition here", BINDING_VALUE (old));
- cp_error_at ("other definition here", BINDING_VALUE (new));
+ cp_error ("use of `%D' is ambiguous", name);
+ cp_error_at (" first declared as `%#D' here", BINDING_VALUE (old));
+ cp_error_at (" also declared as `%#D' here", BINDING_VALUE (new));
return error_mark_node;
}
}
@@ -4239,6 +4239,15 @@ arg_assoc_class (k, type)
&& decl_namespace (TREE_VALUE (list)) == context)
if (add_function (k, TREE_VALUE (list)))
return 1;
+
+ /* Process template arguments. */
+ if (CLASSTYPE_TEMPLATE_INFO (type))
+ {
+ list = innermost_args (CLASSTYPE_TI_ARGS (type), 0);
+ for (i = 0; i < TREE_VEC_LENGTH (list); ++i)
+ arg_assoc (k, TREE_VEC_ELT (list, i));
+ }
+
return 0;
}
@@ -4316,6 +4325,9 @@ arg_assoc (k, n)
struct arg_lookup* k;
tree n;
{
+ if (n == error_mark_node)
+ return 0;
+
if (TREE_CODE_CLASS (TREE_CODE (n)) == 't')
return arg_assoc_type (k, n);
@@ -4324,7 +4336,7 @@ arg_assoc (k, n)
if (TREE_CODE (n) == ADDR_EXPR)
n = TREE_OPERAND (n, 0);
- if (TREE_CODE (n) == TREE_LIST)
+ while (TREE_CODE (n) == TREE_LIST)
n = TREE_VALUE (n);
my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 47d8c1f..62d061b 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -2737,7 +2737,7 @@ readescape (ignore_ptr)
/* Value is 1 (or 2) if we should try to make the next identifier look like
a typename (when it may be a local variable or a class variable).
Value is 0 if we treat this name in a default fashion. */
-int looking_for_typename = 0;
+int looking_for_typename;
#ifdef __GNUC__
__inline