aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@dcc.unicamp.br>1999-07-01 16:08:07 +0000
committerAlexandre Oliva <oliva@gcc.gnu.org>1999-07-01 16:08:07 +0000
commit5f04b627077460e517e89f82b21b89956d0a9ce9 (patch)
treec95f84c020f10cee3c8dc15e0da9ffa0c7780ee0 /gcc
parent5ec024f064c4f77520bec255e76e0829d5f0eb09 (diff)
downloadgcc-5f04b627077460e517e89f82b21b89956d0a9ce9.zip
gcc-5f04b627077460e517e89f82b21b89956d0a9ce9.tar.gz
gcc-5f04b627077460e517e89f82b21b89956d0a9ce9.tar.bz2
* partord1.C: New test.
From-SVN: r27887
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.oliva/partord1.C28
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog b/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog
index f8076c1..6c45507 100644
--- a/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog
@@ -1,4 +1,6 @@
1999-07-01 Alexandre Oliva <oliva@dcc.unicamp.br>
+ * partord1.C: New test.
+
* template1.C: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/partord1.C b/gcc/testsuite/g++.old-deja/g++.oliva/partord1.C
new file mode 100644
index 0000000..7ed017a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/partord1.C
@@ -0,0 +1,28 @@
+// Build don't link:
+
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+
+template <typename T> void foo(T);
+template <typename T> void foo(T*);
+
+template <typename T> class bar {
+ private:
+ int i; // ERROR - this variable
+ friend void foo<T>(T);
+};
+
+template <typename T> void foo(T) {
+ bar<T>().i = 0; // ok, I'm a friend
+}
+template <typename T> void foo(T*) {
+ bar<T*>().i = 1; // ERROR - not a friend
+}
+
+int main() {
+ int j = 0;
+ foo(j); // calls foo<int>(int), ok
+ foo(&j); // calls foo<int>(int*) // ERROR - not a friend
+ foo<int*>(&j); // calls foo<int*>(int*), ok
+}