OSDN Git Service

gcp/ChangeLog:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Nov 2000 09:55:32 +0000 (09:55 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Nov 2000 09:55:32 +0000 (09:55 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37340 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/lex.c
gcc/cp/parse.y
gcc/cp/spew.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/operator1.C [new file with mode: 0644]

index c11bad0..9bda1b6 100644 (file)
@@ -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
index 8d0f5e6..d4e3c8f 100644 (file)
@@ -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;
index 5e99862..b8dff06 100644 (file)
@@ -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:
index 8faf91b..9e6b65b 100644 (file)
@@ -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;
 }
index 37586a3..79029d9 100644 (file)
@@ -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 (file)
index 0000000..dc016ad
--- /dev/null
@@ -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);