From: No Author Date: Sun, 16 Mar 2003 14:28:43 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch X-Git-Tag: releases/gcc-3.2.3~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d48bc49ddef1251f967b0757fc739e96f9f1f23c;p=thirdparty%2Fgcc.git This commit was manufactured by cvs2svn to create branch 'gcc-3_2-branch'. From-SVN: r64436 --- diff --git a/gcc/testsuite/g++.dg/template/spec7.C b/gcc/testsuite/g++.dg/template/spec7.C new file mode 100644 index 000000000000..18d3c90c45e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec7.C @@ -0,0 +1,27 @@ +// { dg-do compile } + +// PR c++/6440: Specialization of member class template. + +template struct A +{ + template struct B {}; +}; + +template<> template +struct A::B +{ + void f(); + template void g(V); +}; + +template<> template<> template void A::B::g(V) +{ +} + +A::B b; + +int h() +{ + b.f(); + b.g(0); +} diff --git a/gcc/testsuite/g++.dg/template/spec8.C b/gcc/testsuite/g++.dg/template/spec8.C new file mode 100644 index 000000000000..26d207b81315 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec8.C @@ -0,0 +1,11 @@ +// { dg-do compile } + +// Specialization of member class template. + +template struct A +{ + template struct B {}; +}; + +template <> template <> struct A::B {}; +template <> template struct A::B {}; // { dg-error "specialization" } diff --git a/gcc/testsuite/gcc.c-torture/execute/20030313-1.c b/gcc/testsuite/gcc.c-torture/execute/20030313-1.c new file mode 100644 index 000000000000..49245a0b39f1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030313-1.c @@ -0,0 +1,68 @@ +struct A +{ + unsigned long p, q, r, s; +} x = { 13, 14, 15, 16 }; + +extern void abort (void); +extern void exit (int); + +static inline struct A * +bar (void) +{ + struct A *r; + + switch (8) + { + case 2: + abort (); + break; + case 8: + r = &x; + break; + default: + abort (); + break; + } + return r; +} + +void +foo (unsigned long *x, int y) +{ + if (y != 12) + abort (); + if (x[0] != 1 || x[1] != 11) + abort (); + if (x[2] != 2 || x[3] != 12) + abort (); + if (x[4] != 3 || x[5] != 13) + abort (); + if (x[6] != 4 || x[7] != 14) + abort (); + if (x[8] != 5 || x[9] != 15) + abort (); + if (x[10] != 6 || x[11] != 16) + abort (); +} + +int +main (void) +{ + unsigned long a[40]; + int b = 0; + + a[b++] = 1; + a[b++] = 11; + a[b++] = 2; + a[b++] = 12; + a[b++] = 3; + a[b++] = bar()->p; + a[b++] = 4; + a[b++] = bar()->q; + a[b++] = 5; + a[b++] = bar()->r; + a[b++] = 6; + a[b++] = bar()->s; + foo (a, b); + exit (0); +}