]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/7176 (g++ confused by friend and static member with same name)
authorMark Mitchell <mark@codesourcery.com>
Mon, 14 Oct 2002 07:46:30 +0000 (07:46 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 14 Oct 2002 07:46:30 +0000 (07:46 +0000)
PR c++/7176
* lex.c (do_identifier): Add another option for the parsing
parameter.
* parse.y (do_id): Use it.

PR c++/7176
* g++.dg/parse/friend1.C: New test.
* g++.old-deja/g++.pt/memtemp64.C: Adjust.

From-SVN: r58119

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 622dca534fc1dae3f444d3408bfe0432ecf17d4c..7d06bba973aa97ed0242c834754e9d749f49ed63 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  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5661
index d68957a9963ee513dffddc9ce6552591dc3ff65e..f3d80f8b1acb0597ff6ba3343cc75454501f5b18 100644 (file)
@@ -1194,7 +1194,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);
@@ -1216,7 +1216,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 678262198a94c99fc9c4f5be0533c84053935a9f..6dadc32d494eb88f9b237304538d15ea9cb4ed8e 100644 (file)
@@ -1507,7 +1507,7 @@ do_id:
                     don't do_identifier; we only do that for unqualified
                     identifiers.  */
                  if (!lastiddecl || TREE_CODE (lastiddecl) != TREE_LIST)
-                   $$ = do_identifier ($<ttype>-1, 1, NULL_TREE);
+                   $$ = do_identifier ($<ttype>-1, 3, NULL_TREE);
                  else
                    $$ = $<ttype>-1;
                }
index f3008b0d96613ff4ecc3a0e7ecc3ccb24842c3bb..3b857e0bcaa8357883257883433ddff894580570 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-11  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5661
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