re PR c++/11507 (parser fails to recognize namespace)
authorAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 7 Sep 2003 03:43:15 +0000 (20:43 -0700)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 7 Sep 2003 03:43:15 +0000 (20:43 -0700)
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

gcc/testsuite/g++.dg/lookup/scoped7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/other/static1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/overload/VLA.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/call1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/crash10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/template-1.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/lookup/scoped7.C b/gcc/testsuite/g++.dg/lookup/scoped7.C
new file mode 100644 (file)
index 0000000..a9d70d0
--- /dev/null
@@ -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 (file)
index 0000000..09e17d4
--- /dev/null
@@ -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 (file)
index 0000000..850e19a
--- /dev/null
@@ -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 (file)
index 0000000..3b6e367
--- /dev/null
@@ -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 (file)
index 0000000..17011f1
--- /dev/null
@@ -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 (file)
index 0000000..04ea5ae
--- /dev/null
@@ -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> ();