diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1997-09-28 15:26:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-09-28 15:26:50 -0400 |
commit | a98d45ff1f4d45241c521994bbf03c438ba0d91f (patch) | |
tree | 46f51afb6f76116d3af368246db7fa5ced5afc7c /gcc | |
parent | 905a881f36b6aea9113a3b369e36e85033bbea84 (diff) | |
download | gcc-a98d45ff1f4d45241c521994bbf03c438ba0d91f.zip gcc-a98d45ff1f4d45241c521994bbf03c438ba0d91f.tar.gz gcc-a98d45ff1f4d45241c521994bbf03c438ba0d91f.tar.bz2 |
new tests and adjustments for explicit function template qualification
From-SVN: r15777
Diffstat (limited to 'gcc')
-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 8940c17..c4c9c83 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 2efcf24..0a8a6cc 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 11d2180..75bd64d 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 567dc20..3870cbc 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 7e5e108..7fa2c76 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 0000000..6f9e7c6 --- /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 0000000..4d911a4 --- /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 29f0aa1..a79c534 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"); |