aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/macro10.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/macro10.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/macro10.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/macro10.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/macro10.c
new file mode 100644
index 000000000..20d4911e6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/macro10.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+
+/* Source: Neil Booth, 23 Sep 2001.
+
+ A tricky, pathological corner case we used to get wrong. Expansion
+ should go as follows. The asterisk indicates the token has "blue
+ paint" can no longer be macro expanded. We used to lose that
+ information when parsing arguments and dropping to the lexer to get
+ the ')'.
+
+ foo )
+ bar foo* )
+ func (foo* )
+ foo*
+
+ If we try and expand the final foo, we get an "unterminated
+ argument list invoking macro <func>" error. If we do the right
+ thing and leave it as is, no diagnostics are emitted. */
+
+#define func(x) x
+#define bar func(
+#define foo bar foo
+foo )