From: Jason Merrill Date: Sun, 28 Sep 1997 19:26:50 +0000 (-0400) Subject: new tests and adjustments for explicit function template qualification X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a98d45ff1f4d45241c521994bbf03c438ba0d91f;p=gcc.git new tests and adjustments for explicit function template qualification From-SVN: r15777 --- 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 template 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 foo { - friend ostream& operator<<(ostream&, foo&); -}; +template class foo; template ostream& operator<< (ostream& ios, foo&obj) { }; +template class foo { + friend ostream& operator<<<>(ostream&, foo&); +}; + 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 inline T min (T a, T b) { return a 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 +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 S; + +template +void operator<<(ostream&, S) {} + +template +class S +{ + friend void operator<<<>(ostream&, const S); +}; + + +int main() +{ + ostream o; + + o << S(); +} 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 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");