From: Jason Merrill Date: Tue, 24 Jul 2001 15:08:37 +0000 (-0400) Subject: move to subdirs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f817aaf987979e473b213f93b02c34b11209ae0;p=gcc.git move to subdirs From-SVN: r44301 --- diff --git a/gcc/testsuite/g++.dg/abi/mangle2.C b/gcc/testsuite/g++.dg/abi/mangle2.C new file mode 100644 index 00000000000..e8b5f409d7c --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle2.C @@ -0,0 +1,19 @@ +// Test that we handle mangling of statics in inlines properly. +// { dg-options -fno-weak } +// { dg-do run } + +inline int f () +{ + static int nested; + nested = 24; + { + static int nested; + nested = 42; + } + return (nested != 24); +} + +int main() +{ + return f (); +} diff --git a/gcc/testsuite/g++.dg/ext/instantiate1.C b/gcc/testsuite/g++.dg/ext/instantiate1.C new file mode 100644 index 00000000000..90a4af0ec67 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/instantiate1.C @@ -0,0 +1,32 @@ +// Test that 'extern template' suppresses instantiations. +// { dg-do link } +// { dg-options "" } + +template void f (T) { } +extern template void f (int); + +template struct A { + void f (); +}; +template void A::f () { } +extern template struct A; + +// { dg-error "void f\\(int\\)" "suppressing f" { target *-*-* } "0" } +void test_f_int () { f(42); } + +// { dg-error "A::f\\(\\)" "suppressing A" { target *-*-* } "0" } +void test_A_int_f () { A a; a.f (); } + +// { dg-bogus "void f\\(double\\)" "f" { target *-*-* } "0" } +void test_f_double () { f (2.0); } + +// { dg-bogus "A::f\\(\\)" "A" { target *-*-* } "0" } +void test_A_double_f () { A b; b.f (); } + +int main () +{ + test_f_int (); + test_A_int_f (); + test_f_double (); + test_A_double_f (); +} diff --git a/gcc/testsuite/g++.dg/ext/lvalue1.C b/gcc/testsuite/g++.dg/ext/lvalue1.C new file mode 100644 index 00000000000..bf883eae21f --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/lvalue1.C @@ -0,0 +1,10 @@ +// Test that we complain about the gcc cast-as-lvalue extension. + +int main () +{ + char c; + + static_cast(c) = 2; // { dg-error "lvalue" "not an lvalue" } + + return c != 2; +} diff --git a/gcc/testsuite/g++.dg/friend-warn.C b/gcc/testsuite/g++.dg/friend-warn.C deleted file mode 100644 index e7982896a92..00000000000 --- a/gcc/testsuite/g++.dg/friend-warn.C +++ /dev/null @@ -1,14 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options -Wredundant-decls } */ - -/* Test to see if spurious warnings about redundant - declarations are emiited because of the friend - declaration. */ - -class Foo -{ - friend void bar (Foo); -public: -}; - -extern void bar (Foo); diff --git a/gcc/testsuite/g++.dg/opt/nrv1.C b/gcc/testsuite/g++.dg/opt/nrv1.C new file mode 100644 index 00000000000..cba16252288 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/nrv1.C @@ -0,0 +1,28 @@ +// Test for the named return value optimization. +// { dg-do run } +// { dg-options -fno-inline } + +int c; +int d; + +struct A +{ + A() { ++c; } + A(const A&) { ++c; }; + ~A() { ++d; } +}; + +inline A f () +{ + A a; + return a; +} + +int main () +{ + { + A a = f (); + } + + return !(c == 1 && c == d); +} diff --git a/gcc/testsuite/g++.dg/other/init-ref1.C b/gcc/testsuite/g++.dg/other/init-ref1.C new file mode 100644 index 00000000000..d0170cd18f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/init-ref1.C @@ -0,0 +1,45 @@ +// Submitted by Erik Rozendaal +// Test case for GNATS bug 787. +// { dg-do run } + +#include +#include + +static int calls; + +int &foo (int &arg) +{ + calls++; + arg=0; + return arg; +} + +int &identity (int &x) +{ + return x; +} + +int main() +{ + int a; + + calls = 0; + int &b = ++foo (a); + if (calls > 1) + abort (); + if (&a != &b) + abort (); + if (a != 1) + abort (); + + calls = 0; + int &c = ++identity (++foo (a)); + if (calls > 1) + abort (); + if (&a != &c) + abort (); + if (a != 2) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/g++.dg/other/init-ref2.C b/gcc/testsuite/g++.dg/other/init-ref2.C new file mode 100644 index 00000000000..6d9448a8e9c --- /dev/null +++ b/gcc/testsuite/g++.dg/other/init-ref2.C @@ -0,0 +1,42 @@ +// Submitted by Jason Merrill +// Test for proper handling of local static references. +// { dg-do run } + +int r; + +int c; +int f () +{ + // Test that we only initialize i once. + if (++c > 1) + ++r; + return 42; +} + +const int *p; +void g () +{ + static const int &i = f(); + + // Test that i points to the same place in both calls. + if (p && p != &i) + ++r; + // Test that if so, it points to static data. + if (i != 42) + ++r; + + p = &i; +} + +void h () +{ + int arr[] = { 1, 1, 1, 1, 1, 1, 1 }; + g (); +} + +int main () +{ + g (); + h (); + return r; +} diff --git a/gcc/testsuite/g++.dg/other/stdbool-if.C b/gcc/testsuite/g++.dg/other/stdbool-if.C new file mode 100644 index 00000000000..e9800bf160d --- /dev/null +++ b/gcc/testsuite/g++.dg/other/stdbool-if.C @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options -pedantic } */ + +/* test of 'true' and 'false' in #if. this is accepted with a pedwarn + before stdbool.h is included, silently afterward. */ + +/* Make sure they're viable keywords. */ +bool a = true; +bool b = false; + +#if true /* { dg-warning "true" "true in #if pedwarn" } */ +#else +#error true is false /* { dg-bogus "true" "true is false" } */ +#endif + +#if false /* { dg-warning "false" "false in #if pedwarn" } */ +#error false is true /* { dg-bogus "false" "false is true" } */ +#endif + +#include + +/* Must still be viable keywords. */ +bool c = true; +bool d = false; + +#if true /* { dg-bogus "true" "true in #if with stdbool.h" } */ +#else +#error true is false /* { dg-bogus "true" "true is false" } */ +#endif + +#if false /* { dg-bogus "false" "false in #if with stdbool.h" } */ +#error false is true /* { dg-bogus "false" "false is true" } */ +#endif diff --git a/gcc/testsuite/g++.dg/stdbool-if.C b/gcc/testsuite/g++.dg/stdbool-if.C deleted file mode 100644 index e9800bf160d..00000000000 --- a/gcc/testsuite/g++.dg/stdbool-if.C +++ /dev/null @@ -1,33 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options -pedantic } */ - -/* test of 'true' and 'false' in #if. this is accepted with a pedwarn - before stdbool.h is included, silently afterward. */ - -/* Make sure they're viable keywords. */ -bool a = true; -bool b = false; - -#if true /* { dg-warning "true" "true in #if pedwarn" } */ -#else -#error true is false /* { dg-bogus "true" "true is false" } */ -#endif - -#if false /* { dg-warning "false" "false in #if pedwarn" } */ -#error false is true /* { dg-bogus "false" "false is true" } */ -#endif - -#include - -/* Must still be viable keywords. */ -bool c = true; -bool d = false; - -#if true /* { dg-bogus "true" "true in #if with stdbool.h" } */ -#else -#error true is false /* { dg-bogus "true" "true is false" } */ -#endif - -#if false /* { dg-bogus "false" "false in #if with stdbool.h" } */ -#error false is true /* { dg-bogus "false" "false is true" } */ -#endif diff --git a/gcc/testsuite/g++.dg/warn/friend.C b/gcc/testsuite/g++.dg/warn/friend.C new file mode 100644 index 00000000000..e7982896a92 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/friend.C @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options -Wredundant-decls } */ + +/* Test to see if spurious warnings about redundant + declarations are emiited because of the friend + declaration. */ + +class Foo +{ + friend void bar (Foo); +public: +}; + +extern void bar (Foo);