aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-11-09 09:55:32 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-11-09 09:55:32 +0000
commit5361cbb793e64b267460096093609afa6848f503 (patch)
treee3020a7ff92b7e82e2ee6e6cbee3922955a909c4
parentc6348fe7c2a6315fbcfe6b373f87ddaf27b649c4 (diff)
downloadgcc-5361cbb793e64b267460096093609afa6848f503.zip
gcc-5361cbb793e64b267460096093609afa6848f503.tar.gz
gcc-5361cbb793e64b267460096093609afa6848f503.tar.bz2
lex.c (do_identifier): Don't lookup_name for operators.
gcp/ChangeLog: * lex.c (do_identifier): Don't lookup_name for operators. * parse.y (operator): Save looking_for_typename. (unoperator): Restore it. * spew.c (frob_opname): Use nth_token for lookahead. testsuite/ChangeLog: * g++.old-deja/g++.pt/operator1.C: New test. From-SVN: r37340
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/lex.c2
-rw-r--r--gcc/cp/parse.y8
-rw-r--r--gcc/cp/spew.c3
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/operator1.C11
6 files changed, 31 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c11bad0..9bda1b6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2000-11-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * lex.c (do_identifier): Don't lookup_name for operators.
+ * parse.y (operator): Save looking_for_typename.
+ (unoperator): Restore it.
+ * spew.c (frob_opname): Use nth_token for lookahead.
+
2000-11-08 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grok_op_properties): Always use coerce_new_type and
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 8d0f5e6..d4e3c8f 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -1264,7 +1264,7 @@ do_identifier (token, parsing, args)
register tree id;
int lexing = (parsing == 1);
- if (! lexing || IDENTIFIER_OPNAME_P (token))
+ if (! lexing)
id = lookup_name (token, 0);
else
id = lastiddecl;
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index 5e99862..b8dff06 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -3747,9 +3747,11 @@ operator:
OPERATOR
{
saved_scopes = tree_cons (got_scope, got_object, saved_scopes);
+ TREE_LANG_FLAG_0 (saved_scopes) = looking_for_typename;
/* We look for conversion-type-id's in both the class and current
scopes, just as for ID in 'ptr->ID::'. */
- looking_for_typename = 1; got_object = got_scope;
+ looking_for_typename = 1;
+ got_object = got_scope;
got_scope = NULL_TREE;
}
;
@@ -3757,7 +3759,9 @@ operator:
unoperator:
{ got_scope = TREE_PURPOSE (saved_scopes);
got_object = TREE_VALUE (saved_scopes);
- saved_scopes = TREE_CHAIN (saved_scopes); }
+ looking_for_typename = TREE_LANG_FLAG_0 (saved_scopes);
+ saved_scopes = TREE_CHAIN (saved_scopes);
+ }
;
operator_name:
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
index 8faf91b..9e6b65b 100644
--- a/gcc/cp/spew.c
+++ b/gcc/cp/spew.c
@@ -956,7 +956,8 @@ frob_id (yyc, peek, idp)
tree frob_opname (id)
tree id;
{
- frob_id (0, yychar, &id);
+ scan_tokens (0);
+ frob_id (0, nth_token (0)->yychar, &id);
got_object = NULL_TREE;
return id;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 37586a3..79029d9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2000-11-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.pt/operator1.C: New test.
+
2000-11-09 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20001108-1.c: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/operator1.C b/gcc/testsuite/g++.old-deja/g++.pt/operator1.C
new file mode 100644
index 0000000..dc016ad
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/operator1.C
@@ -0,0 +1,11 @@
+// Build don't link:
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 7 Nov 2000 <nathan@codesourcery.com>
+// Origin: bug 510 wolfgang.bangerth@iwr.uni-heidelberg.de
+
+struct Example {
+template <class U> void operator= (U);
+};
+
+template <>
+void Example::operator=<double> (double);