New test; for odd case of token pasting
authorZack Weinberg <zack@gcc.gnu.org>
Sun, 4 Jul 1999 16:28:56 +0000 (16:28 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Sun, 4 Jul 1999 16:28:56 +0000 (16:28 +0000)
From-SVN: r27937

gcc/testsuite/gcc.dg/990703-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/990703-1.c b/gcc/testsuite/gcc.dg/990703-1.c
new file mode 100644 (file)
index 0000000..b953a5b
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+
+/* Test of obscure case in token pasting in the preprocessor.
+   I can't think of any way to make this problem provoke a syntax error.
+   Based on a bug report by Manfred Hollstein.  */
+
+#include <string.h>
+
+#define SP1(x, y) SP2(x, y)
+#define SP2(x, y) SP3(x##y)
+#define SP3(x) #x
+#define MZ -0
+
+int
+main(void)
+{
+    char *x = SP1(0,MZ);
+    char *y = "0-0"  /* should be the expansion of SP1(0,MZ) */
+
+    if(strcmp(x, y))
+       return 1;
+    else
+       return 0;
+}