diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-09-28 19:26:50 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-09-28 19:26:50 +0000 |
commit | 9afeb2a0cd66055448b3be44bd1855a4c184d936 (patch) | |
tree | 46f51afb6f76116d3af368246db7fa5ced5afc7c | |
parent | 597fe38f703719d06c59863b9cab3bb3886694d2 (diff) |
new tests and adjustments for explicit function template qualification
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@15777 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.brendan/template9.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/template13.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/template38.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.law/template2.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/explicit36.C | 24 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/explicit37.C | 23 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C | 2 |
8 files changed, 56 insertions, 7 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template9.C b/gcc/testsuite/g++.old-deja/g++.brendan/template9.C index 8940c17724d..c4c9c831157 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template9.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template9.C @@ -1,6 +1,7 @@ // GROUPS passed templates // Test that the compiler will emit the definition of min given just // the declaration. At one point in the past, it did not. +// Special g++ Options: -fguiding-decls #include <iostream.h> template <class T> inline T min(T a, T b) { return (a < b) ? a : b;}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C b/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C index 2efcf241bf4..0a8a6cc378c 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C @@ -6,12 +6,14 @@ struct ostream { ostream& operator<< (const char *) { return *this; }; }; -template <class T> class foo { - friend ostream& operator<<(ostream&, foo<T>&); -}; +template <class T> class foo; template <class T> ostream& operator<< (ostream& ios, foo<T>&obj) { }; +template <class T> class foo { + friend ostream& operator<<<>(ostream&, foo<T>&); +}; + int main() { ostream cout; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template13.C b/gcc/testsuite/g++.old-deja/g++.jason/template13.C index 11d21801846..75bd64d7ff3 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template13.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template13.C @@ -1,6 +1,6 @@ // Bug: g++ fails to actually instantiate templates to the specifications of // guiding decls. -// Special g++ Options: -g -ansi -pedantic-errors +// Special g++ Options: -g -ansi -pedantic-errors -fguiding-decls template <class T> inline T min (T a, T b) { return a<b?a:b; } double min (double, double); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template38.C b/gcc/testsuite/g++.old-deja/g++.jason/template38.C index 567dc20e419..3870cbc5c14 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template38.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template38.C @@ -1,4 +1,4 @@ -// Special g++ Options: -fansi-overloading +// Special g++ Options: -fguiding-decls struct A { friend int operator== (const A&, const A&); diff --git a/gcc/testsuite/g++.old-deja/g++.law/template2.C b/gcc/testsuite/g++.old-deja/g++.law/template2.C index 7e5e108a728..7fa2c766b83 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/template2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/template2.C @@ -1,4 +1,5 @@ // GROUPS passed templates +// Special g++ Options: -fguiding-decls extern "C" void printf (char *, ...); template<class T> T max(T a, T b) { return a > b ? a : b; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit36.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit36.C new file mode 100644 index 00000000000..6f9e7c6b468 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit36.C @@ -0,0 +1,24 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +void foo(T); + +class S { + friend void foo<>(int); + + int i; +}; + + +template <> +void foo(int) +{ + S s; + s.i = 3; +} + + +int main() +{ + foo(3); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit37.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit37.C new file mode 100644 index 00000000000..4d911a43f2a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit37.C @@ -0,0 +1,23 @@ +// Build don't run: +// GROUPS passed templates +class ostream {}; + +template <class T> +class S; + +template <class T> +void operator<<(ostream&, S<T>) {} + +template <class T> +class S +{ + friend void operator<<<>(ostream&, const S<T>); +}; + + +int main() +{ + ostream o; + + o << S<int>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C index 29f0aa10f31..a79c53467d5 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C @@ -10,7 +10,6 @@ struct S template <class U> void foo(char*, U); - template <> void foo(int i); }; @@ -28,7 +27,6 @@ void S::foo(char*, U u) } -template <> void S::foo(int i) { printf ("int version\n"); |