re PR c++/7176 (g++ confused by friend and static member with same name)
authorMark Mitchell <mark@codesourcery.com>
Mon, 14 Oct 2002 21:09:25 +0000 (21:09 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 14 Oct 2002 21:09:25 +0000 (21:09 +0000)
PR c++/7176
* g++.dg/parse/friend1.C: New test.
* g++.old-deja/g++.pt/memtemp64.C: Adjust.

PR c++/7176
* lex.c (do_identifier): Add another option for the parsing
parameter.
* parse.y (do_id): Use it.

From-SVN: r58135

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

index 5704c900663998934bbbd816fc2f4d9e5beed1fe..e5c7356e5afe8261a30b27ed083e8d4a22c60311 100644 (file)
@@ -1,3 +1,10 @@
+2002-10-14  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/7176
+       * lex.c (do_identifier): Add another option for the parsing
+       parameter.
+       * parse.y (do_id): Use it.
+
 2002-10-11  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        PRs C++/6803, C++/7721 and C++/7803
index 2342c2320c7a4d780ab7aa48d5044aa6cf573e87..bab29888e8b8c626d1442d48885912a43109899c 100644 (file)
@@ -1135,7 +1135,7 @@ do_identifier (token, parsing, args)
      tree args;
 {
   register tree id;
-  int lexing = (parsing == 1);
+  int lexing = (parsing == 1 || parsing == 3);
 
   if (! lexing)
     id = lookup_name (token, 0);
@@ -1157,7 +1157,7 @@ do_identifier (token, parsing, args)
 
   /* Remember that this name has been used in the class definition, as per
      [class.scope0] */
-  if (id && parsing)
+  if (id && parsing && parsing != 3)
     maybe_note_name_used_in_class (token, id);
 
   if (id == error_mark_node)
index 104c4a70ed032a37f4f3bd6d11b7f9fd55955691..78cf991f1924d20a26656f867bf23252e9f2d80b 100644 (file)
@@ -1516,7 +1516,7 @@ do_id:
                     do_identifier; we only do that for unqualified
                     identifiers.  */
                  if (!lastiddecl || !BASELINK_P (lastiddecl))
-                   $$ = do_identifier ($<ttype>-1, 1, NULL_TREE);
+                   $$ = do_identifier ($<ttype>-1, 3, NULL_TREE);
                  else
                    $$ = $<ttype>-1;
                }
index 76df36f02b8f4abeefc2ad15385d99945bed17f0..5b1374cc043847384d623467d6a494f78cdd2a2a 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-14  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/7176
+       * g++.dg/parse/friend1.C: New test.
+       * g++.old-deja/g++.pt/memtemp64.C: Adjust.
+
 2002-10-14  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/20021014-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/parse/friend1.C b/gcc/testsuite/g++.dg/parse/friend1.C
new file mode 100644 (file)
index 0000000..f19dc9c
--- /dev/null
@@ -0,0 +1,9 @@
+namespace N {
+  template <typename T>
+  static void f ();
+
+  struct S {
+    friend void N::f<int> ();
+    static void f (int);
+  };
+}
index fbebe3ae82f6cde862a139026766391d556577cf..6185d3d60583b11bf6dcf0f1ae1518fa758820b4 100644 (file)
@@ -4,7 +4,7 @@ template <class T>
 struct S1 {};
 
 template <class T>
-void f(T); // ERROR - original declaration.
+void f(T);
 
 template <class C>
 struct S2