summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/undef1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/undef1.c')
-rw-r--r--gcc/testsuite/gcc.dg/cpp/undef1.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/undef1.c b/gcc/testsuite/gcc.dg/cpp/undef1.c
new file mode 100644
index 00000000000..024efcede65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/undef1.c
@@ -0,0 +1,14 @@
+/* { dg-do preprocess } */
+
+/* 6.9.3.11: ...If there are sequences of preprocessing tokens within
+ the list of arguments that would otherwise act as preprocessing
+ directives, the behavior is undefined.
+
+ I choose to make this a hard error. It definitely should not cause
+ a core dump. */
+
+#define foo(bar) bar
+
+foo( blah
+#undef foo /* { dg-error "may not be used inside" "foo(#undef foo)" } */
+ blah )