summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/friend.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/friend.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/friend.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/friend.C b/gcc/testsuite/g++.old-deja/g++.jason/friend.C
new file mode 100644
index 000000000..9bcc81488
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.jason/friend.C
@@ -0,0 +1,20 @@
+// { dg-do run }
+// Bug: g++ doesn't keep track of the lexical context of friends properly.
+
+extern "C" void exit(int);
+
+struct B;
+struct A {
+ static void f () { exit (1); }
+};
+
+struct B {
+ static void f () { exit (0); }
+ friend void g (B) { f (); }
+};
+
+int main ()
+{
+ B b;
+ g (b);
+}