diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2001-07-24 11:08:37 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2001-07-24 11:08:37 -0400 |
commit | 6f817aaf987979e473b213f93b02c34b11209ae0 (patch) | |
tree | 109804103fbaaca84d3e7ce9e9457e26d43ec80c | |
parent | f8b529aa0a7a54c178fdc13b2033ee14a4b69c73 (diff) | |
download | gcc-6f817aaf987979e473b213f93b02c34b11209ae0.zip gcc-6f817aaf987979e473b213f93b02c34b11209ae0.tar.gz gcc-6f817aaf987979e473b213f93b02c34b11209ae0.tar.bz2 |
move to subdirs
From-SVN: r44301
-rw-r--r-- | gcc/testsuite/g++.dg/abi/mangle2.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/instantiate1.C | 32 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/lvalue1.C | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/nrv1.C | 28 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/init-ref1.C | 45 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/init-ref2.C | 42 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/stdbool-if.C (renamed from gcc/testsuite/g++.dg/stdbool-if.C) | 0 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/friend.C (renamed from gcc/testsuite/g++.dg/friend-warn.C) | 0 |
8 files changed, 176 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/mangle2.C b/gcc/testsuite/g++.dg/abi/mangle2.C new file mode 100644 index 0000000..e8b5f40 --- /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 0000000..90a4af0 --- /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 <class T> void f (T) { } +extern template void f (int); + +template <class T> struct A { + void f (); +}; +template <class T> void A<T>::f () { } +extern template struct A<int>; + +// { dg-error "void f<int>\\(int\\)" "suppressing f<int>" { target *-*-* } "0" } +void test_f_int () { f(42); } + +// { dg-error "A<int>::f\\(\\)" "suppressing A<int>" { target *-*-* } "0" } +void test_A_int_f () { A<int> a; a.f (); } + +// { dg-bogus "void f<double>\\(double\\)" "f<double>" { target *-*-* } "0" } +void test_f_double () { f (2.0); } + +// { dg-bogus "A<double>::f\\(\\)" "A<double>" { target *-*-* } "0" } +void test_A_double_f () { A<double> 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 0000000..bf883ea --- /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<int>(c) = 2; // { dg-error "lvalue" "not an lvalue" } + + return c != 2; +} diff --git a/gcc/testsuite/g++.dg/opt/nrv1.C b/gcc/testsuite/g++.dg/opt/nrv1.C new file mode 100644 index 0000000..cba1625 --- /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 0000000..d0170cd --- /dev/null +++ b/gcc/testsuite/g++.dg/other/init-ref1.C @@ -0,0 +1,45 @@ +// Submitted by Erik Rozendaal <dlr@acm.org> +// Test case for GNATS bug 787. +// { dg-do run } + +#include <stdio.h> +#include <stdlib.h> + +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 0000000..6d9448a --- /dev/null +++ b/gcc/testsuite/g++.dg/other/init-ref2.C @@ -0,0 +1,42 @@ +// Submitted by Jason Merrill <jason_merrill@redhat.com> +// 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/stdbool-if.C b/gcc/testsuite/g++.dg/other/stdbool-if.C index e9800bf..e9800bf 100644 --- a/gcc/testsuite/g++.dg/stdbool-if.C +++ b/gcc/testsuite/g++.dg/other/stdbool-if.C diff --git a/gcc/testsuite/g++.dg/friend-warn.C b/gcc/testsuite/g++.dg/warn/friend.C index e798289..e798289 100644 --- a/gcc/testsuite/g++.dg/friend-warn.C +++ b/gcc/testsuite/g++.dg/warn/friend.C |