From 5361cbb793e64b267460096093609afa6848f503 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 9 Nov 2000 09:55:32 +0000 Subject: 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 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/lex.c | 2 +- gcc/cp/parse.y | 8 ++++++-- gcc/cp/spew.c | 3 ++- 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'gcc/cp') 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 + + * 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 * 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; } -- cgit v1.1