new file mode 100644
@@ -0,0 +1,11 @@
+// Test token pasting with digit separators avoided for preprocessed output.
+// { dg-do compile { target c++14 } }
+// { dg-options "-save-temps" }
+
+#define ZERO 0
+
+int
+f ()
+{
+ return ZERO'0'0; /* { dg-error "expected" } */
+}
new file mode 100644
@@ -0,0 +1,12 @@
+/* Test C2x digit separators. Test token pasting avoided for preprocessed
+ output. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -save-temps" } */
+
+#define ZERO 0
+
+int
+f (void)
+{
+ return ZERO'0'0; /* { dg-error "expected" } */
+}
@@ -3725,6 +3725,7 @@ cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1,
|| b == CPP_NAME
|| b == CPP_CHAR || b == CPP_STRING); /* L */
case CPP_NUMBER: return (b == CPP_NUMBER || b == CPP_NAME
+ || b == CPP_CHAR
|| c == '.' || c == '+' || c == '-');
/* UCNs */
case CPP_OTHER: return ((token1->val.str.text[0] == '\\'