diff gcc/testsuite/gcc.dg/cpp/pr23827_c99.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/cpp/pr23827_c99.c	Fri Oct 27 22:46:09 2017 +0900
@@ -0,0 +1,23 @@
+/* { dg-do run { target c++11 } }  */
+/* { dg-options "-pedantic-errors" }  */
+
+#define f (
+#define l )
+#define str(x) #x
+#define xstr(x) str(x)
+
+/* C90 and C++98: "0x1p+( 0x1p+)"  */
+/* C99 and C++11: "0x1p+f 0x1p+l"  */
+const char *s = xstr(0x1p+f 0x1p+l);
+
+void abort (void);
+int strcmp (const char *, const char *);
+
+int
+main()
+{
+  if (strcmp (s, "0x1p+( 0x1p+)"))
+    return 0; /* Correct C99 and C++11 behavior.  */
+  else
+    abort (); /* Correct C90 and C++ behavior.  */
+}