summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/preprocessor/escaped-newlines.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/preprocessor/escaped-newlines.slang b/tests/preprocessor/escaped-newlines.slang
new file mode 100644
index 000000000..1c1fa8f10
--- /dev/null
+++ b/tests/preprocessor/escaped-newlines.slang
@@ -0,0 +1,23 @@
+//TEST:SIMPLE:
+
+// Test support for escaped newlines in macro definitions.
+//
+// A complete lexer would handle backslash-escaped newlines
+// in every possible context (including, e.g., in the middle
+// of an identifier), but we are not going to go to such
+// lengths right now.
+
+#define FOO(x, y) \
+ x \
+ y \
+ /* */
+
+FOO(float, bar)(float a)
+{
+ FOO(return, a);
+}
+
+float foo(float x)
+{
+ return bar(x);
+}