This is a proposed C++ paper (P2290R1) that has not been accepted yet
\x{XXXX} \u{XXXX} and \o{OOOO} are accepted in all languages mode
in characters and string literals.
Paths
| Differential D105737
Implement delimited escape sequences. ClosedPublic Authored by cor3ntin on Jul 9 2021, 2:09 PM.
Details
Summary This is a proposed C++ paper (P2290R1) that has not been accepted yet \x{XXXX} \u{XXXX} and \o{OOOO} are accepted in all languages mode
Diff Detail
Event Timelineefriedma removed a child revision: D34362: [LNT] Support for different DataSet usage in Polybench for "lnt runtest nt".Jul 17 2021, 3:02 PM cor3ntin retitled this revision from Implement delimited escape sequences. to [WIP] Implement delimited escape sequences..Jul 18 2021, 11:45 PM Comment Actions Because this proposal hasn't been accepted by WG21 or WG14, but the syntax is not defined by either standard, I think it's reasonable to support this but with appropriate warnings about it being a Clang extension. Can you add those diagnostics? Also, this is lacking test coverage for C.
Comment Actions
between 2 concatenated strings, and sequences containing digit
cor3ntin retitled this revision from [WIP] Implement delimited escape sequences. to Implement delimited escape sequences..Jul 21 2021, 6:46 AM cor3ntin marked 2 inline comments as done. Comment Actions
cor3ntin marked an inline comment as not done. Comment Actions
Comment Actions When preprocessing, treat incomplete or empty Overflow is still treated as an error. Comment Actions Mostly some small nits.
cor3ntin marked 8 inline comments as done. Comment ActionsAddress most of the comments I left warn_delimited_ucn and err_ucn_escape_incomplete Comment Actions
This proposal has now been seen by both WG14 and WG21 and has sentiment for support in both committees. I think the extension diagnostic is still reasonable (we'll want to support this syntax in older language modes when both committees adopt it for a newer language mode). LGTM, I'm down to only some minor nits with the patch. @rsmith, do you have any concerns you'd like to see addressed before landing this?
This revision is now accepted and ready to land.Sep 8 2021, 8:57 AM Comment Actions
Just to clarify, I don't think this should be allowed in C++20 or C17. Do you agree? Comment Actions
I could agree, but I'm wondering why you don't want to allow in older language modes? Clang typically allows conforming extensions in older language modes (with appropriate diagnostics), and this would qualify. e.g., https://godbolt.org/z/x5Ws6YdGc Comment Actions Thank you for the new feature! I've landed on your behalf in 274adcb866343cb505408d8f401840ea814522c8.
Revision Contents
Diff 371682 clang/include/clang/Basic/DiagnosticLexKinds.td
clang/lib/Lex/Lexer.cpp
clang/lib/Lex/LiteralSupport.cpp
clang/test/Lexer/char-escapes-delimited.c
clang/test/Parser/cxx11-user-defined-literals.cpp
clang/test/Preprocessor/ucn-pp-identifier.c
clang/test/Sema/ucn-identifiers.c
|
We usually capitalize Clang for this kind of diagnostic.