]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Thu, 6 Jan 2005 19:12:04 +0000 (19:12 +0000)
committerNo Author <no-author@gcc.gnu.org>
Thu, 6 Jan 2005 19:12:04 +0000 (19:12 +0000)
'gcc-3_4-branch'.

From-SVN: r93002

gcc/testsuite/g++.dg/lookup/friend6.C [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20030916-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/lookup/friend6.C b/gcc/testsuite/g++.dg/lookup/friend6.C
new file mode 100644 (file)
index 0000000..e3dafb1
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-do compile }
+
+// Origin: Matt Austern <austern@apple.com>
+
+// PR c++/19258: Wrong lookup scope for friend defined in class.
+
+class X {
+  template<class T> friend int ff(T*, int y=anX.x) { return y; }
+  int f() { return ff(&anX); }
+
+  static X anX;
+  int x;
+};
+
+X dummy;
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030916-1.c b/gcc/testsuite/gcc.c-torture/execute/20030916-1.c
new file mode 100644 (file)
index 0000000..8b460c6
--- /dev/null
@@ -0,0 +1,35 @@
+/* "i" overflows in f().  Check that x[i] is not treated as a giv.  */
+#include <limits.h>
+
+#if CHAR_BIT == 8
+
+void f (unsigned int *x)
+{
+  unsigned char i;
+  int j;
+
+  i = 0x10;
+  for (j = 0; j < 0x10; j++)
+    {
+      i += 0xe8;
+      x[i] = 0;
+      i -= 0xe7;
+    }
+}
+
+int main ()
+{
+  unsigned int x[256];
+  int i;
+
+  for (i = 0; i < 256; i++)
+    x[i] = 1;
+  f (x);
+  for (i = 0; i < 256; i++)
+    if (x[i] != (i >= 0x08 && i < 0xf8))
+      abort ();
+  exit (0);
+}
+#else
+int main () { exit (0); }
+#endif