Hi!

P2843R3 dropped the
"If there is a form-feed or a vertical-tab character in such a comment, only
whitespace characters shall appear between it and the new-line that terminates
the comment; no diagnostic is required."
sentence from [lex.comment].  AFAIK we've never diagnosed nor checked for
that and C23 doesn't have anything like that, so the following testcase
merely tests that we don't diagnose anything on it.

Tested on x86_64-linux, ok for trunk?

2025-08-01  Jakub Jelinek  <ja...@redhat.com>

        * c-c++-common/cpp/comment-ff-1.c: New test.
        * c-c++-common/cpp/comment-vtab-1.c: New test.

--- gcc/testsuite/c-c++-common/cpp/comment-ff-1.c.jj    2025-08-01 
10:19:42.646504545 +0200
+++ gcc/testsuite/c-c++-common/cpp/comment-ff-1.c       2025-08-01 
10:20:16.028071275 +0200
@@ -0,0 +1,12 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// Test that form-feed followed by non-whitespace
+// in line comments are accepted.
+// { dg-do compile }
+// { dg-options "-pedantic-errors -Wall -W" }
+
+// 
+int a;
+//    
+int b;
+//  comment
+int c;
--- gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c.jj  2025-08-01 
10:19:42.646504545 +0200
+++ gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c     2025-08-01 
10:19:56.445325445 +0200
@@ -0,0 +1,12 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// Test that vertical tab followed by non-whitespace
+// in line comments are accepted.
+// { dg-do compile }
+// { dg-options "-pedantic-errors -Wall -W" }
+
+// 
+int a;
+//    
+int b;
+//  comment
+int c;

        Jakub

Reply via email to