From 1afc355025f984fb0b26d68a7337f987890e6042 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 11 Nov 1997 01:38:34 -0500 Subject: [PATCH] new tests From-SVN: r16426 --- gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C | 45 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C | 45 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C | 38 ++++++++++++ .../g++.old-deja/g++.jason/inline3.C | 42 +++++++++++++ .../g++.old-deja/g++.jason/overload36.C | 15 +++++ gcc/testsuite/g++.old-deja/g++.jason/pmf9.C | 57 +++++++++++++++++ .../g++.old-deja/g++.jason/template44.C | 61 +++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.mike/virt6.C | 39 ++++++++++++ .../g++.old-deja/g++.pt/explicit50.C | 15 +++++ .../g++.old-deja/g++.pt/explicit51.C | 18 ++++++ .../g++.old-deja/g++.pt/explicit52.C | 18 ++++++ .../g++.old-deja/g++.pt/explicit53.C | 21 +++++++ .../g++.old-deja/g++.pt/explicit54.C | 35 +++++++++++ .../g++.old-deja/g++.pt/explicit55.C | 14 +++++ .../g++.old-deja/g++.pt/explicit56.C | 16 +++++ .../g++.old-deja/g++.pt/explicit57.C | 42 +++++++++++++ .../g++.old-deja/g++.pt/explicit58.C | 41 +++++++++++++ .../g++.old-deja/g++.pt/explicit59.C | 41 +++++++++++++ .../g++.old-deja/g++.pt/explicit60.C | 43 +++++++++++++ .../g++.old-deja/g++.pt/explicit61.C | 43 +++++++++++++ .../g++.old-deja/g++.pt/explicit62.C | 19 ++++++ .../g++.old-deja/g++.pt/explicit63.C | 19 ++++++ .../g++.old-deja/g++.pt/explicit64.C | 23 +++++++ .../g++.old-deja/g++.pt/explicit65.C | 33 ++++++++++ gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C | 13 ++++ gcc/testsuite/g++.old-deja/g++.pt/partial1.C | 26 ++++++++ gcc/testsuite/g++.old-deja/g++.pt/typedef1.C | 18 ++++++ gcc/testsuite/g++.old-deja/g++.pt/typename3.C | 17 ++++++ gcc/testsuite/g++.old-deja/g++.pt/unify1.C | 14 +++++ 29 files changed, 871 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/inline3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload36.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template44.C create mode 100644 gcc/testsuite/g++.old-deja/g++.mike/virt6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit50.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit51.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit52.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit53.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit54.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit55.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit56.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit57.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit58.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit59.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit60.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit61.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit62.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit63.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit64.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit65.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/partial1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/typedef1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/typename3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/unify1.C diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C new file mode 100644 index 00000000000..ef4dcb4f19d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C @@ -0,0 +1,45 @@ +// Testcase for proper handling of rethrow. + +#include + +int c, d; + +struct A +{ + int i; + A () { i = ++c; printf ("A() %d\n", i); } + A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } + ~A() { printf ("~A() %d\n", i); ++d; } +}; + +int +main () +{ + try + { + try + { + printf ("Throwing 1...\n"); + throw A(); + } + catch (A) + { + try + { + printf ("Throwing 2...\n"); + throw A(); + } + catch (A) + { + printf ("Throwing 3...\n"); + throw; + } + } + } + catch (A) + { + printf ("Caught.\n"); + } + printf ("c == %d, d == %d\n", c, d); + return c != d; +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C new file mode 100644 index 00000000000..2d2583b7219 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C @@ -0,0 +1,45 @@ +// Testcase for proper handling of rethrow. + +#include + +int c, d; + +struct A +{ + int i; + A () { i = ++c; printf ("A() %d\n", i); } + A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } + ~A() { printf ("~A() %d\n", i); ++d; } +}; + +int +main () +{ + try + { + try + { + printf ("Throwing 1...\n"); + throw A(); + } + catch (A) + { + try + { + printf ("Throwing 2...\n"); + throw; + } + catch (A) + { + printf ("Throwing 3...\n"); + throw; + } + } + } + catch (A) + { + printf ("Caught.\n"); + } + printf ("c == %d, d == %d\n", c, d); + return c != d; +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C new file mode 100644 index 00000000000..355bedc64c9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C @@ -0,0 +1,38 @@ +#include +#include + +static void +eh_terminate () +{ + printf ("CALLING TERMINATE\n"); + exit (1); +} + +void +eh_test (int level) +{ + try + { + if (level < 2) + eh_test (level + 1); + else + { + printf ("%d: Throwing\n", level); + throw (level); + } + } + catch (int &x) + { + printf ("%d: Got level %d\n", + level, x); + + if (level > 0) + throw; + } +} + +main () +{ + set_terminate (&eh_terminate); + eh_test (0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/inline3.C b/gcc/testsuite/g++.old-deja/g++.jason/inline3.C new file mode 100644 index 00000000000..00d57eb3ea1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/inline3.C @@ -0,0 +1,42 @@ +// Testcase for order of destruction. +// Special g++ Options: -O2 + +extern "C" int printf( char const*, ... ); +int c; +int r; + +struct B { + B(); + B( B const& ); + ~B(); +}; + +struct A { + A(); + A( A const& ); + ~A(); + operator B (); +}; + +inline A::operator B () { printf( "operator B ()\n"); return B(); } + +A f(); +void g( B const& ); + +int +main() +{ + g( f() ); + return r; +} + +B::B() { printf( "B::B()\n" ); if (++c != 2) r = 1; } +B::B( B const& ) { printf( "B::B( B const& )\n" ); r = 1; } +B::~B() { printf( "B::~B()\n" ); if (--c != 1) r = 1; } + +A::A() { printf( "A::A()\n" ); if (++c != 1) r = 1; } +A::A( A const& ) { printf( "A::A( A const& )\n" ); r = 1; } +A::~A() { printf( "A::~A()\n" ); if (--c != 0) r = 1; } + +A f() { printf( "f()\n"); return A(); } +void g( B const& ) { printf( "g()\n"); } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload36.C b/gcc/testsuite/g++.old-deja/g++.jason/overload36.C new file mode 100644 index 00000000000..f5e6fb61dc3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload36.C @@ -0,0 +1,15 @@ +// Test for subsequence checking in overload resolution. + +class foo { +public: + void operator <<(char *) { } + void operator <<(const char * const &); +}; + +int +main() +{ + char s[20]; + foo f; + f << s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C new file mode 100644 index 00000000000..335cfccb8c0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C @@ -0,0 +1,57 @@ +// PRMS id: g++/13340 +// Build don't link: + +class rectangle { + +public: + rectangle(); + int overlaps() const; + +}; + +class region +{ + friend class region_impl; + +public: + region(); + typedef int (region::* region_func)() const; + +}; + +class region_impl { + friend class region; + +private: + rectangle content, mbb; + region_impl *link_p; + region_impl(const rectangle &content); + +public: + int iterate(region *region_p, region::region_func what, + const rectangle &clip_rect) const; + int iterate(region *region_p, region::region_func what, + const region_impl &clip_rgn) const; +}; + + +int +region_impl::iterate (region *region_p, region::region_func what, + const rectangle &clip_rect) const +{ + for (const region_impl *p = this; p != 0 && p->mbb.overlaps(); + p = p->link_p) + if (p->content.overlaps()) + if (!(region_p->*what)()) return 0; + return 1; +} + +int +region_impl::iterate (region *region_p, region::region_func what, + const region_impl &clip_rgn) const +{ + for (const region_impl *p = this; p != 0 && p->mbb.overlaps(); + p = p->link_p) + if (!clip_rgn.iterate(region_p, what, p->content)) return 0; + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template44.C b/gcc/testsuite/g++.old-deja/g++.jason/template44.C new file mode 100644 index 00000000000..93b47bd23e6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template44.C @@ -0,0 +1,61 @@ +#include +#include + +template +class List { +public: + int len; + T *array; + + int length() const { return( len ); } + + List() : len( 0 ), array( 0 ) {} +}; + +template +int AlgoStdCompare(const T* a, const T* b) { + if (*a < *b) + return -1; + else + return (*a > *b); // 0 if equal, 1 if greater +} + +int AlgoStdCompare(const char* const* a, const char * const*b) +{ + return strcmp(*a,*b); +} + +template +void AlgoFixupSort(List< T >* , int, int ) { +} + +template +void AlgoSort(int (*compare)(const T *, const T *), + void (*fixup)( List *, int first, int last), + List< T >* theList, int first, int last) { + if (last < 0) + last = theList->length()-1; + + qsort(theList->array+first, last-first+1, sizeof(T), + (int (*)(const void *, const void *))compare); + if (fixup) + fixup(theList, first, last); +} + +template +void AlgoSort(List< T >* theList, int first = 0, int last = -1) { + int (*compare)(const T*, const T*) = AlgoStdCompare; + void (*fixup)( List *, int first, int last) = AlgoFixupSort; + + AlgoSort(compare, fixup, theList, first, last); +} + +int +main() +{ + List slist; + AlgoSort( &slist ); + + List ilist; + AlgoSort( &ilist ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.mike/virt6.C b/gcc/testsuite/g++.old-deja/g++.mike/virt6.C new file mode 100644 index 00000000000..61491cede48 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.mike/virt6.C @@ -0,0 +1,39 @@ +// This testcase ensures that we can build vtable names for complex MI +// classes. + +class C_A { +public: + virtual int foo(void *) { } +} a; + +class C_B : public C_A { +} b; + +class C_C : public C_A { +} c; + +class C_D : public C_A { +} d; + +class C_E : public C_C, public C_B { +public: + virtual int foo(void *) { } +} e; + +class C_F : public C_D, public C_B { +public: + virtual int foo(void *) { } +} f; + +class C_G : public C_A { +public: + virtual int foo(void *) { } +} g; + +class C_H : public C_G, public C_E, public C_F { +public: + virtual int foo(void *) { } +} h; + +int main() { +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit50.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit50.C new file mode 100644 index 00000000000..8c424cc744c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit50.C @@ -0,0 +1,15 @@ +extern "C" void abort (); + +template int f () +{ + return sizeof(T); +} + +int main () +{ + if (f () != sizeof(long) + || f () != sizeof(char) + || f () != sizeof(long) + || f () != sizeof(long int)) + abort (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit51.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit51.C new file mode 100644 index 00000000000..e4a0a64c46e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit51.C @@ -0,0 +1,18 @@ +extern "C" void abort (); + +template int fact () +{ + return 0; +} + +template <> int fact<1> () +{ + return 1; +} + +int main() +{ + if (fact<3> () != 0 || fact<1> () != 1 + || fact<3> () != 0 || fact<1> () != 1 || fact<1+0> () != 1) + abort (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit52.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit52.C new file mode 100644 index 00000000000..368573e5b85 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit52.C @@ -0,0 +1,18 @@ +extern "C" void abort (); + +template inline int fact () +{ + return a * fact (); +} + +template <> inline int fact<1> () +{ + return 1; +} + +int main() +{ + if (fact<3> () != 6 || fact<1> () != 1 + || fact<3> () != 6 || fact<1> () != 1 || fact<1+0> () != 1) + abort (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit53.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit53.C new file mode 100644 index 00000000000..e66cca99d5c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit53.C @@ -0,0 +1,21 @@ +extern "C" void abort (); + +template inline int fact (); +template <> inline int fact<1> (); + +template inline int fact () +{ + return a * fact (); +} + +template <> inline int fact<1> () +{ + return 1; +} + +int main() +{ + if (fact<3> () != 6 || fact<1> () != 1 + || fact<3> () != 6 || fact<1> () != 1 || fact<1+0> () != 1) + abort (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit54.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit54.C new file mode 100644 index 00000000000..9d185be24ce --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit54.C @@ -0,0 +1,35 @@ +extern "C" void abort (); + +template inline int fact2 (); + +template inline int fact () +{ + return a * fact2 (); +} + +template <> inline int fact<1> () +{ + return 1; +} + +template inline int fact2 () +{ + return a*fact(); +} + +template <> inline int fact2<1> () +{ + return 1; +} + +int main() +{ + if (fact<3> () != 6 || fact<1> () != 1 + || fact<3> () != 6 || fact<1> () != 1 || fact<1+0> () != 1) + abort (); + if (fact2<3> () != 6 || fact2<1> () != 1 + || fact2<3> () != 6 || fact2<1> () != 1 || fact2<1+0> () != 1) + abort (); + if (fact2<4> () != 24 || fact<4> () != 24) + abort (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit55.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit55.C new file mode 100644 index 00000000000..c9d312520a8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit55.C @@ -0,0 +1,14 @@ +template T* create () +{ + return new T; +} + +template T* create2() +{ + return create(); +} + +int main() +{ + int *p = create2(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit56.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit56.C new file mode 100644 index 00000000000..d202160be16 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit56.C @@ -0,0 +1,16 @@ +template T* create (); + +template T* create2() +{ + return create(); +} + +template T* create () +{ + return new T; +} + +int main() +{ + int *p = create2(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit57.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit57.C new file mode 100644 index 00000000000..d1f0ea870dc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit57.C @@ -0,0 +1,42 @@ +extern "C" void abort (); + +int a = 0; + +template void f (); +template void g () +{ + if (a) + abort (); +} + +template <> void g () +{ +} + +template class C +{ + public: + void ff () { f (); } + void gg () { g (); } +}; + +template void f () +{ + if (a) + abort (); +} + +template <> void f () +{ +} + +int main () +{ + C c; + c.ff(); + c.gg(); + a = 1; + C d; + d.ff(); + d.gg(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit58.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit58.C new file mode 100644 index 00000000000..7193d2d84bd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit58.C @@ -0,0 +1,41 @@ +extern "C" void abort (); + +template void f (); +template void g () +{ + abort (); +} + +template <> void g () +{ + abort (); +} + +template class C +{ + public: + template void f () {} + template void g () {} + void ff () { f (); } + void gg () { g (); } +}; + +template void f () +{ + abort (); +} + +template <> void f () +{ + abort (); +} + +int main () +{ + C c; + c.ff(); + c.gg(); + C d; + d.ff(); + d.gg(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit59.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit59.C new file mode 100644 index 00000000000..847a80acca6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit59.C @@ -0,0 +1,41 @@ +extern "C" void abort (); + +template void f (); +template void g () +{ + abort (); +} + +template <> void g () +{ + abort (); +} + +template class C +{ + public: + void ff () { f (); } + void gg () { g (); } + template void f () {} + template void g () {} +}; + +template void f () +{ + abort (); +} + +template <> void f () +{ + abort (); +} + +int main () +{ + C c; + c.ff(); + c.gg(); + C d; + d.ff(); + d.gg(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit60.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit60.C new file mode 100644 index 00000000000..5fda3335585 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit60.C @@ -0,0 +1,43 @@ +extern "C" void abort (); + +template void f (); +template void g () +{ + abort (); +} + +template <> void g () +{ + abort (); +} + +template class C +{ + public: + void ff () { f (); } + void gg () { g (); } + template void f () {} + template void g () {} + template void f (int) { abort(); } + template void g (int) { abort(); } +}; + +template void f () +{ + abort (); +} + +template <> void f () +{ + abort (); +} + +int main () +{ + C c; + c.ff(); + c.gg(); + C d; + d.ff(); + d.gg(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit61.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit61.C new file mode 100644 index 00000000000..69b78914742 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit61.C @@ -0,0 +1,43 @@ +extern "C" void abort (); + +template void f (); +template void g () +{ + abort (); +} + +template <> void g () +{ + abort (); +} + +template class C +{ + public: + void ff () { f (0); } + void gg () { g (1); } + template void f () { abort(); } + template void g () { abort(); } + template void f (int) {} + template void g (int) {} +}; + +template void f () +{ + abort (); +} + +template <> void f () +{ + abort (); +} + +int main () +{ + C c; + c.ff(); + c.gg(); + C d; + d.ff(); + d.gg(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit62.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit62.C new file mode 100644 index 00000000000..5917ce01cf3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit62.C @@ -0,0 +1,19 @@ +extern "C" void abort (); + +template void f () +{ +} + + +template class C +{ + friend void f (); + public: + void ff () { f (); } +}; + +int main () +{ + C c; + c.ff(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit63.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit63.C new file mode 100644 index 00000000000..ce4d99af1e7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit63.C @@ -0,0 +1,19 @@ +extern "C" void abort (); + +template void f () +{ +} + + +template class C +{ + friend void f (); + public: + void ff () { f (); } +}; + +int main () +{ + C c; + c.ff(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit64.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit64.C new file mode 100644 index 00000000000..2208b30eae7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit64.C @@ -0,0 +1,23 @@ +extern "C" void abort (); + +template void f () +{ + abort (); +} + +template <> void f () +{ +} + +template class C +{ + friend void f (); + public: + void ff () { f (); } +}; + +int main () +{ + C c; + c.ff(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit65.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit65.C new file mode 100644 index 00000000000..a026e8ee3f3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit65.C @@ -0,0 +1,33 @@ +extern "C" void abort (); + +template void f () +{ + abort (); +} + +template <> void f () +{ + abort (); +} + +template void f (int) +{ + abort (); +} + +template <> void f (int) +{ +} + +template class C +{ + friend void f (int); + public: + void ff () { f (0); } +}; + +int main () +{ + C c; + c.ff(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C new file mode 100644 index 00000000000..6b7fc8e44f9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C @@ -0,0 +1,13 @@ +template struct A { + template void f (U u); +}; + +A a; + +template template void A::f (U u) { } + +main() +{ + a.f (24); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/partial1.C b/gcc/testsuite/g++.old-deja/g++.pt/partial1.C new file mode 100644 index 00000000000..7a929962fd4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/partial1.C @@ -0,0 +1,26 @@ +template +class foo { +public: + enum bar { z = 0 }; +}; + +template +class foo { +public: + enum bar { z = 1 }; +}; + +template +class foo { +public: + enum bar { z = 2 }; +}; + +int main() +{ + if ((foo::z == 0) && (foo::z == 1) + && (foo::z == 2)) + return 0; + else + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typedef1.C b/gcc/testsuite/g++.old-deja/g++.pt/typedef1.C new file mode 100644 index 00000000000..5de152ef7dc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typedef1.C @@ -0,0 +1,18 @@ +// Testcase for handling of typedef wierdness. +// Build don't link: + +template +class A +{ + typedef enum + { + foo + } B; + + A (B b); +}; + +template +A::A (B b) +{ +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename3.C b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C new file mode 100644 index 00000000000..13a1fcc85d1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C @@ -0,0 +1,17 @@ +// Build don't link: +// GROUPS passed templates +template +struct bar { + typedef typename T::baz baz; +}; + +template +void foo(T) +{ + bar::baz(); // ERROR - T is int. +} + +void foobar() +{ + foo(3); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify1.C b/gcc/testsuite/g++.old-deja/g++.pt/unify1.C new file mode 100644 index 00000000000..283e2f50f8a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/unify1.C @@ -0,0 +1,14 @@ +// Tests non-unification of parms that don't use template parms. +// Build don't link: + +enum kind {a, b}; + +class C { public: C () {} }; + +template +void f (P c, kind k) {} + +template +void f (P c, P d, kind k) {} + +template void f (C c, C c, kind k); -- 2.30.2