aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c
new file mode 100644
index 000000000..edcf2abf2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c
@@ -0,0 +1,23 @@
+/* Test that nested commas and parentheses in macro arguments are
+ OK. */
+
+/* { dg-do preprocess } */
+
+#define f(x) x
+#define g(x, y) x y
+
+#if f((1)) != 1
+# error /* { dg-bogus "error" "nested parens 1" } */
+#endif
+
+#if f((1, 2)) != 2
+# error /* { dg-bogus "error" "nested comma 1" } */
+#endif
+
+#if g(, (1)) != 1
+# error /* { dg-bogus "error" "nested parens 2" } */
+#endif
+
+#if g((1, 2), + 3) != 5
+# error /* { dg-bogus "error" "nested comma 2" } */
+#endif