aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-02-23 02:33:03 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-02-23 02:33:03 +0000
commit25200ab2eba3e561d47d411b81612f7eda9ec109 (patch)
tree46607056e20f28c3cf5b9827577d25881ce1321c
parent515edc9bf896285f284228b9b798a633c06f3037 (diff)
downloadgcc-25200ab2eba3e561d47d411b81612f7eda9ec109.zip
gcc-25200ab2eba3e561d47d411b81612f7eda9ec109.tar.gz
gcc-25200ab2eba3e561d47d411b81612f7eda9ec109.tar.bz2
* spew.c (yylex): Correct handling of friends.
From-SVN: r39990
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/spew.c10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/friend11.C12
3 files changed, 23 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 26899a5..0bb8645 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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
FUNCTION_DECL for the function being encoded.
(write_function_type): Pass it along to write_bare_function_type.
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
index ba2013b..02157f0 100644
--- a/gcc/cp/spew.c
+++ b/gcc/cp/spew.c
@@ -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
index 0000000..b9804c4
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/friend11.C
@@ -0,0 +1,12 @@
+// Build don't link:
+// Origin: robt@flyingpig.com
+
+class Outer
+{
+ friend void f1();
+ class Inner2;
+};
+
+class Outer::Inner2
+{
+};