From: Jason Merrill Date: Fri, 15 Mar 2002 11:07:04 +0000 (-0500) Subject: relocate tests to appropriate directories X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=190f491640e073c03fbdfa3c4f830331f9e9262b;p=gcc.git relocate tests to appropriate directories From-SVN: r50806 --- diff --git a/gcc/testsuite/g++.dg/eh/spec2.C b/gcc/testsuite/g++.dg/eh/spec2.C new file mode 100644 index 00000000000..64807dd2677 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/spec2.C @@ -0,0 +1,10 @@ +// { dg-do compile } + +struct S { void f (void); }; + +typedef void f1 (void) throw (int); // { dg-error "exception" } +typedef void (*f2) (void) throw (int); // { dg-error "exception" } +typedef void (S::*f3) (void) throw (int); // { dg-error "exception" } + +void (*f4) (void) throw (int); +void (S::*f5) (void) throw (int); diff --git a/gcc/testsuite/g++.dg/init/init-ref3.C b/gcc/testsuite/g++.dg/init/init-ref3.C new file mode 100644 index 00000000000..aaf04cff684 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/init-ref3.C @@ -0,0 +1,47 @@ +// Origin: Peter Schmid + +// { dg-do link } + +template +class Ptr { +protected: + T * ptr; + +public: + + Ptr(void) : ptr(0) { }; + Ptr(T * p) : ptr(p) { }; + + ~Ptr(void) { delete ptr; } + + operator T & () { return *ptr; } +}; + +class base { +public: + base(void) { } + ~base(void) { } +}; + + +class foo : public base { +private: + foo(const foo & rv); + +public: + + foo(void) { } + ~foo(void) { } +}; + +void func2(base & b) { + // ... +} + +int main () { + Ptr f = new foo; + /* This should not result in a copy; the result of the conversion + operator should be bound directly to the reference argument to + `func2'. */ + func2(f); +} diff --git a/gcc/testsuite/g++.dg/lookup/forscope1.C b/gcc/testsuite/g++.dg/lookup/forscope1.C new file mode 100644 index 00000000000..e694d6f2332 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/forscope1.C @@ -0,0 +1,25 @@ +// { dg-do compile } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Sept 2001 + +// Bug 4206. We were nesting SCOPE_STMTs badly. + +struct A +{ + A (); + ~A (); +}; + + +void Go( ) +{ + while (1) + { + switch (1) { + default: {} + } + A d; + } + +} diff --git a/gcc/testsuite/g++.dg/other/deprecated.C b/gcc/testsuite/g++.dg/other/deprecated.C deleted file mode 100644 index 10560705031..00000000000 --- a/gcc/testsuite/g++.dg/other/deprecated.C +++ /dev/null @@ -1,117 +0,0 @@ -/* Test __attribute__ ((deprecated)) */ -/* { dg-do compile } */ -/* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */ - -#if 1 -typedef int INT1 __attribute__((deprecated)); -typedef INT1 INT2 __attribute__ ((__deprecated__)); - -typedef INT1 INT1a; /* { dg-warning "`INT1' is deprecated" "" } */ -typedef INT1 INT1b __attribute__ ((deprecated)); - -INT1 should_be_unavailable; /* { dg-warning "`INT1' is deprecated" "" } */ -INT1a should_not_be_deprecated; - -INT1 f1(void) __attribute__ ((deprecated)); -INT1 f2(void) { return 0; } /* { dg-warning "`INT1' is deprecated" "" } */ - -INT2 f3(void) __attribute__ ((__deprecated__)); -INT2 f4(void) { return 0; } /* { dg-warning "`INT2' is deprecated" "" } */ -int f5(INT2 x); /* { dg-warning "`INT2' is deprecated" "" } */ -int f6(INT2 x) __attribute__ ((__deprecated__)); - -typedef enum {red, green, blue} Color __attribute__((deprecated)); - -int g1; -int g2 __attribute__ ((deprecated)); -int g3 __attribute__ ((__deprecated__)); -Color k; /* { dg-warning "`Color' is deprecated" "" } */ - -typedef struct { - int field1; - int field2 __attribute__ ((deprecated)); - int field3; - int field4 __attribute__ ((__deprecated__)); - union { - int field5; - int field6 __attribute__ ((deprecated)); - } u1; - int field7:1; - int field8:1 __attribute__ ((deprecated)); - union { - int field9; - int field10; - } u2 __attribute__ ((deprecated)); -} S1; - -int func1() -{ - INT1 w; /* { dg-warning "`INT1' is deprecated" "" } */ - int x __attribute__ ((deprecated)); - int y __attribute__ ((__deprecated__)); - int z; - int (*pf)() = f1; /* { dg-warning "`f1' is deprecated" "" } */ - - z = w + x + y + g1 + g2 + g3; /* { dg-warning "`x' is deprecated" "" } */ - /* { dg-warning "`y' is deprecated" "" { target *-*-* } 55 } */ - /* { dg-warning "`g2' is deprecated" "" { target *-*-* } 55 } */ - /* { dg-warning "`g3' is deprecated" "" { target *-*-* } 55 } */ - return f1(); /* { dg-warning "`f1' is deprecated" "" } */ -} - -int func2(S1 *p) -{ - S1 lp; - - if (p->field1) - return p->field2; /* { dg-warning "`field2' is deprecated" "" } */ - else if (lp.field4) /* { dg-warning "`field4' is deprecated" "" } */ - return p->field3; - - p->u1.field5 = g1 + p->field7; - p->u2.field9; /* { dg-warning "`u2' is deprecated" "" } */ - return p->u1.field6 + p->field8; /* { dg-warning "`field6' is deprecated" "" } */ - /* { dg-warning "`field8' is deprecated" "" { target *-*-* } 73 } */ -} - -struct SS1 { - int x; - INT1 y; /* { dg-warning "`INT1' is deprecated" "" } */ -} __attribute__ ((deprecated)); - -struct SS1 *p1; /* { dg-warning "`SS1' is deprecated" "" } */ - -struct __attribute__ ((__deprecated__)) SS2 { - int x; - INT1 y; /* { dg-warning "`INT1' is deprecated" "" } */ -}; - -struct SS2 *p2; /* { dg-warning "`SS2' is deprecated" "" } */ -#endif - -#ifdef __cplusplus -class T { - public: - void member1(int) __attribute__ ((deprecated)); - void member2(INT1) __attribute__ ((__deprecated__)); /* { dg-warning "`INT1' is deprecated" "" } */ - int member3(T *); - int x; -} __attribute__ ((deprecated)); - -T *p3; - -inline void T::member1(int) {} - -int T::member3(T *p) -{ - p->member1(1); /* { dg-warning "`member1' is deprecated" "" } */ - (*p).member1(2); /* { dg-warning "`member1' is deprecated" "" } */ - p->member2(1); /* { dg-warning "`member2' is deprecated" "" } */ - (*p).member2(2); /* { dg-warning "`member2' is deprecated" "" } */ - p->member3(p); - (*p).member3(p); - return f1(); /* { dg-warning "`f1' is deprecated" "" } */ -} -#endif - - diff --git a/gcc/testsuite/g++.dg/other/exception-specification.C b/gcc/testsuite/g++.dg/other/exception-specification.C deleted file mode 100644 index 64807dd2677..00000000000 --- a/gcc/testsuite/g++.dg/other/exception-specification.C +++ /dev/null @@ -1,10 +0,0 @@ -// { dg-do compile } - -struct S { void f (void); }; - -typedef void f1 (void) throw (int); // { dg-error "exception" } -typedef void (*f2) (void) throw (int); // { dg-error "exception" } -typedef void (S::*f3) (void) throw (int); // { dg-error "exception" } - -void (*f4) (void) throw (int); -void (S::*f5) (void) throw (int); diff --git a/gcc/testsuite/g++.dg/other/forscope1.C b/gcc/testsuite/g++.dg/other/forscope1.C deleted file mode 100644 index e694d6f2332..00000000000 --- a/gcc/testsuite/g++.dg/other/forscope1.C +++ /dev/null @@ -1,25 +0,0 @@ -// { dg-do compile } - -// Copyright (C) 2001 Free Software Foundation, Inc. -// Contributed by Nathan Sidwell 4 Sept 2001 - -// Bug 4206. We were nesting SCOPE_STMTs badly. - -struct A -{ - A (); - ~A (); -}; - - -void Go( ) -{ - while (1) - { - switch (1) { - default: {} - } - A d; - } - -} diff --git a/gcc/testsuite/g++.dg/ref1.C b/gcc/testsuite/g++.dg/ref1.C deleted file mode 100644 index aaf04cff684..00000000000 --- a/gcc/testsuite/g++.dg/ref1.C +++ /dev/null @@ -1,47 +0,0 @@ -// Origin: Peter Schmid - -// { dg-do link } - -template -class Ptr { -protected: - T * ptr; - -public: - - Ptr(void) : ptr(0) { }; - Ptr(T * p) : ptr(p) { }; - - ~Ptr(void) { delete ptr; } - - operator T & () { return *ptr; } -}; - -class base { -public: - base(void) { } - ~base(void) { } -}; - - -class foo : public base { -private: - foo(const foo & rv); - -public: - - foo(void) { } - ~foo(void) { } -}; - -void func2(base & b) { - // ... -} - -int main () { - Ptr f = new foo; - /* This should not result in a copy; the result of the conversion - operator should be bound directly to the reference argument to - `func2'. */ - func2(f); -} diff --git a/gcc/testsuite/g++.dg/sizeof1.C b/gcc/testsuite/g++.dg/sizeof1.C deleted file mode 100644 index 328d647473c..00000000000 --- a/gcc/testsuite/g++.dg/sizeof1.C +++ /dev/null @@ -1,15 +0,0 @@ -// Test use of `sizeof' as a template parameter. -// Origin: smacdonald@seimac.com - -// { dg-do compile } - -template struct A {}; - -template -struct B -{ -char * f() const -{ -return (A::value); -} -}; diff --git a/gcc/testsuite/g++.dg/template/sizeof1.C b/gcc/testsuite/g++.dg/template/sizeof1.C new file mode 100644 index 00000000000..328d647473c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sizeof1.C @@ -0,0 +1,15 @@ +// Test use of `sizeof' as a template parameter. +// Origin: smacdonald@seimac.com + +// { dg-do compile } + +template struct A {}; + +template +struct B +{ +char * f() const +{ +return (A::value); +} +}; diff --git a/gcc/testsuite/g++.dg/warn/deprecated.C b/gcc/testsuite/g++.dg/warn/deprecated.C new file mode 100644 index 00000000000..10560705031 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/deprecated.C @@ -0,0 +1,117 @@ +/* Test __attribute__ ((deprecated)) */ +/* { dg-do compile } */ +/* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */ + +#if 1 +typedef int INT1 __attribute__((deprecated)); +typedef INT1 INT2 __attribute__ ((__deprecated__)); + +typedef INT1 INT1a; /* { dg-warning "`INT1' is deprecated" "" } */ +typedef INT1 INT1b __attribute__ ((deprecated)); + +INT1 should_be_unavailable; /* { dg-warning "`INT1' is deprecated" "" } */ +INT1a should_not_be_deprecated; + +INT1 f1(void) __attribute__ ((deprecated)); +INT1 f2(void) { return 0; } /* { dg-warning "`INT1' is deprecated" "" } */ + +INT2 f3(void) __attribute__ ((__deprecated__)); +INT2 f4(void) { return 0; } /* { dg-warning "`INT2' is deprecated" "" } */ +int f5(INT2 x); /* { dg-warning "`INT2' is deprecated" "" } */ +int f6(INT2 x) __attribute__ ((__deprecated__)); + +typedef enum {red, green, blue} Color __attribute__((deprecated)); + +int g1; +int g2 __attribute__ ((deprecated)); +int g3 __attribute__ ((__deprecated__)); +Color k; /* { dg-warning "`Color' is deprecated" "" } */ + +typedef struct { + int field1; + int field2 __attribute__ ((deprecated)); + int field3; + int field4 __attribute__ ((__deprecated__)); + union { + int field5; + int field6 __attribute__ ((deprecated)); + } u1; + int field7:1; + int field8:1 __attribute__ ((deprecated)); + union { + int field9; + int field10; + } u2 __attribute__ ((deprecated)); +} S1; + +int func1() +{ + INT1 w; /* { dg-warning "`INT1' is deprecated" "" } */ + int x __attribute__ ((deprecated)); + int y __attribute__ ((__deprecated__)); + int z; + int (*pf)() = f1; /* { dg-warning "`f1' is deprecated" "" } */ + + z = w + x + y + g1 + g2 + g3; /* { dg-warning "`x' is deprecated" "" } */ + /* { dg-warning "`y' is deprecated" "" { target *-*-* } 55 } */ + /* { dg-warning "`g2' is deprecated" "" { target *-*-* } 55 } */ + /* { dg-warning "`g3' is deprecated" "" { target *-*-* } 55 } */ + return f1(); /* { dg-warning "`f1' is deprecated" "" } */ +} + +int func2(S1 *p) +{ + S1 lp; + + if (p->field1) + return p->field2; /* { dg-warning "`field2' is deprecated" "" } */ + else if (lp.field4) /* { dg-warning "`field4' is deprecated" "" } */ + return p->field3; + + p->u1.field5 = g1 + p->field7; + p->u2.field9; /* { dg-warning "`u2' is deprecated" "" } */ + return p->u1.field6 + p->field8; /* { dg-warning "`field6' is deprecated" "" } */ + /* { dg-warning "`field8' is deprecated" "" { target *-*-* } 73 } */ +} + +struct SS1 { + int x; + INT1 y; /* { dg-warning "`INT1' is deprecated" "" } */ +} __attribute__ ((deprecated)); + +struct SS1 *p1; /* { dg-warning "`SS1' is deprecated" "" } */ + +struct __attribute__ ((__deprecated__)) SS2 { + int x; + INT1 y; /* { dg-warning "`INT1' is deprecated" "" } */ +}; + +struct SS2 *p2; /* { dg-warning "`SS2' is deprecated" "" } */ +#endif + +#ifdef __cplusplus +class T { + public: + void member1(int) __attribute__ ((deprecated)); + void member2(INT1) __attribute__ ((__deprecated__)); /* { dg-warning "`INT1' is deprecated" "" } */ + int member3(T *); + int x; +} __attribute__ ((deprecated)); + +T *p3; + +inline void T::member1(int) {} + +int T::member3(T *p) +{ + p->member1(1); /* { dg-warning "`member1' is deprecated" "" } */ + (*p).member1(2); /* { dg-warning "`member1' is deprecated" "" } */ + p->member2(1); /* { dg-warning "`member2' is deprecated" "" } */ + (*p).member2(2); /* { dg-warning "`member2' is deprecated" "" } */ + p->member3(p); + (*p).member3(p); + return f1(); /* { dg-warning "`f1' is deprecated" "" } */ +} +#endif + +