]> gcc.gnu.org Git - gcc.git/commitdiff
* spew.c (yylex): Correct handling of friends.
authorMark Mitchell <mark@codesourcery.com>
Fri, 23 Feb 2001 02:33:03 +0000 (02:33 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 23 Feb 2001 02:33:03 +0000 (02:33 +0000)
From-SVN: r39990

gcc/cp/ChangeLog
gcc/cp/spew.c
gcc/testsuite/g++.old-deja/g++.other/friend11.C [new file with mode: 0644]

index 26899a55a9e7e591dede16fe1f62ef0a4c5727f3..0bb8645667a03b2a9619e1745d90b44c113a4388 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-22  Mark Mitchell  <mark@codesourcery.com>
+
+       * spew.c (yylex): Correct handling of friends.
+
 2001-02-22  Mark Mitchell  <mark@codesourcery.com>
 
        * mangle.c (write_encoding): Pass write_function_type the
index ba2013b8142948b8e4895d958336f187d993245f..02157f00b450530d28af7f72aa95b0b90e7dbe5e 100644 (file)
@@ -719,6 +719,8 @@ yylex ()
 {
   int yychr;
   int old_looking_for_typename = 0;
+  int just_saw_new = 0;
+  int just_saw_friend = 0;
 
   timevar_push (TV_LEX);
 
@@ -804,13 +806,13 @@ yylex ()
        }
       /* do_aggr needs to know if the previous token was `friend'.  */
       else if (nth_token (0)->yylval.ttype == ridpointers[RID_FRIEND])
-       after_friend = 1;
+       just_saw_friend = 1;
 
       break;
 
     case NEW:
       /* do_aggr needs to know if the previous token was `new'.  */
-      after_new = 1;
+      just_saw_new = 1;
       break;
 
     case TYPESPEC:
@@ -824,7 +826,6 @@ yylex ()
 
     case AGGR:
       do_aggr ();
-      after_friend = after_new = 0;
       break;
 
     case ENUM:
@@ -836,6 +837,9 @@ yylex ()
       break;
     }
 
+  after_friend = just_saw_friend;
+  after_new = just_saw_new;
+
   /* class member lookup only applies to the first token after the object
      expression, except for explicit destructor calls.  */
   if (yychr != '~')
diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend11.C b/gcc/testsuite/g++.old-deja/g++.other/friend11.C
new file mode 100644 (file)
index 0000000..b9804c4
--- /dev/null
@@ -0,0 +1,12 @@
+// Build don't link:
+// Origin: robt@flyingpig.com
+
+class Outer
+{
+  friend void f1(); 
+  class Inner2;
+};
+
+class Outer::Inner2
+{
+};
This page took 0.078751 seconds and 5 git commands to generate.