https://gcc.gnu.org/g:43472f2cc0ef6c702c649947d379f334a4262596

commit r16-3030-g43472f2cc0ef6c702c649947d379f334a4262596
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Aug 6 10:44:09 2025 +0200

    c++: Add test for vt/ff in line comments
    
    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.
    
    2025-08-06  Jakub Jelinek  <ja...@redhat.com>
    
            PR preprocessor/120778
            * c-c++-common/cpp/comment-ff-1.c: New test.
            * c-c++-common/cpp/comment-vtab-1.c: New test.

Diff:
---
 gcc/testsuite/c-c++-common/cpp/comment-ff-1.c   | 12 ++++++++++++
 gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/gcc/testsuite/c-c++-common/cpp/comment-ff-1.c 
b/gcc/testsuite/c-c++-common/cpp/comment-ff-1.c
new file mode 100644
index 000000000000..0d071b134b43
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/comment-ff-1.c
@@ -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;
diff --git a/gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c 
b/gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c
new file mode 100644
index 000000000000..03feb73d0bd0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c
@@ -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;

Reply via email to