diff options
author | Andrew Pinski <pinskia@gcc.gnu.org> | 2003-09-06 20:43:15 -0700 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2003-09-06 20:43:15 -0700 |
commit | ef8f74d66da4c6034217dfe1147bb24e0193ef80 (patch) | |
tree | 2ee0b0469d6f58bbe87a5a3498b2b6c216c907ce | |
parent | 9aec989f02e1af104b6c70da8ad4c494e0e81a46 (diff) | |
download | gcc-ef8f74d66da4c6034217dfe1147bb24e0193ef80.zip gcc-ef8f74d66da4c6034217dfe1147bb24e0193ef80.tar.gz gcc-ef8f74d66da4c6034217dfe1147bb24e0193ef80.tar.bz2 |
re PR c++/11507 (parser fails to recognize namespace)
2003-09-06 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/11507
* g++.dg/lookup/scoped7.C: New test.
PR c++/9574
* g++.dg/other/static1.C: New test.
PR c++/11490
* g++.dg/warn/template-1.C: New test.
PR c++/11432
* g++.dg/template/crash10.C: New test.
PR c++/2478
* g++.dg/overload/VLA.C: New test.
PR c++/10804
* g++.dg/template/call1.C: New test.
From-SVN: r71156
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/scoped7.C | 20 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/static1.C | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/overload/VLA.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/call1.C | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash10.C | 27 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/template-1.C | 15 |
6 files changed, 112 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lookup/scoped7.C b/gcc/testsuite/g++.dg/lookup/scoped7.C new file mode 100644 index 0000000..a9d70d0 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/scoped7.C @@ -0,0 +1,20 @@ +//PR c++/11507 +// Origin: kai-gcc-bugs@khms.westfalen.de and bangerth@dealii.org +//The new parser used to fail on this. + +// { dg-do compile } + +namespace NS +{ + void foo(bool arg1); +} + +namespace M { + namespace K { + bool Bc(bool x); + } + + void bar() { + NS::foo (K::Bc(true)); // GCC could not find K or Bc. + } +} diff --git a/gcc/testsuite/g++.dg/other/static1.C b/gcc/testsuite/g++.dg/other/static1.C new file mode 100644 index 0000000..09e17d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/static1.C @@ -0,0 +1,17 @@ +// PR c++/9574 +// Origin: fche@redhat.com and bangerth@dealii.org +// The new parser ICE on this test and then it could +// not find z in bar::bar(). + +// { dg-do compile } + +struct X { + void operator[](const int& __k); +}; +struct foo { + static X x; +}; +struct bar { + int z; + bar () { foo::x[z]; }; +}; diff --git a/gcc/testsuite/g++.dg/overload/VLA.C b/gcc/testsuite/g++.dg/overload/VLA.C new file mode 100644 index 0000000..850e19a --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/VLA.C @@ -0,0 +1,16 @@ +//Origin: kengole@us.ibm.com + +//PR c++/2478 +// G++ was rejecting this as it could not convert `int (*)[]' to `int (*)[0]'. +// Using the C99 VLA style arrays in a struct. + +// { dg-do compile } + +struct { + int (*p)[]; +} B; + +void foo() { + int (*p)[]; + B.p=p; // { dg-bogus "cannot convert" } +} diff --git a/gcc/testsuite/g++.dg/template/call1.C b/gcc/testsuite/g++.dg/template/call1.C new file mode 100644 index 0000000..3b6e367 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/call1.C @@ -0,0 +1,17 @@ +//Origin: harinath@cs.umn.edu +//PR c++/10804 +// G++ was not emiting the function foo. + +// { dg-do run } + + +template<class T> +struct A +{ + A() { const void (*a)() = foo; } + static const void foo() {} +}; +int main(int argc, char *argv[]) +{ + A<int> a; +} diff --git a/gcc/testsuite/g++.dg/template/crash10.C b/gcc/testsuite/g++.dg/template/crash10.C new file mode 100644 index 0000000..17011f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash10.C @@ -0,0 +1,27 @@ +//Origin: benko@sztaki.hu +//PR c++/11432 +// The mainline ICE on this one between 2003-01-16 and 2003-07-29. + + // { dg-do run } + + extern "C" void abort(); + + +template <int A> +struct a +{ + static int const value = A - 1; +}; + + +template <int B> +struct b +{ + static int foo() + { + return a<L>::value; + } + + + static int const L = a<B + 1>::value; +}; diff --git a/gcc/testsuite/g++.dg/warn/template-1.C b/gcc/testsuite/g++.dg/warn/template-1.C new file mode 100644 index 0000000..04ea5ae --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/template-1.C @@ -0,0 +1,15 @@ +//Origin: bangerth@dealii.org +//PR c++/11490 +//Since N is know at instantiation time, there +// should be no warning about comparision between +// unsinged and signed interegers. + +// { dg-do compile } +// { dg-options "-W" } + +template <int N> bool f() { + unsigned int i=0; + return i!=N; // { dg-bogus "signed and unsigned" } +} + +template bool f<2> (); |