[PATCH] D156596: [Clang] Produce a warning instead of an error in unevaluated strings before C++26
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 1 01:00:19 PDT 2023
cor3ntin added inline comments.
================
Comment at: clang/test/CXX/dcl.dcl/dcl.link/p2.cpp:11-14
+extern u8"C" {} // expected-warning {{encoding prefix 'u8' on an unevaluated string literal has no effect and is incompatible with c++2c}}
+extern L"C" {} // expected-warning {{encoding prefix 'L' on an unevaluated string literal has no effect and is incompatible with c++2c}}
+extern u"C++" {} // expected-warning {{encoding prefix 'u' on an unevaluated string literal has no effect and is incompatible with c++2c}}
+extern U"C" {} // expected-warning {{encoding prefix 'U' on an unevaluated string literal has no effect and is incompatible with c++2c}}
----------------
Note that was ill-formed in clang 16, despite being well-formed in the standard.
================
Comment at: clang/test/SemaCXX/static-assert.cpp:44-45
+static_assert(false, L"\x1ff" // expected-warning {{encoding prefix 'L' on an unevaluated string literal has no effect and is incompatible with c++2c}} \
+ // expected-error {{hex escape sequence out of range}} \
// expected-error {{invalid escape sequence '\x1ff' in an unevaluated string literal}}
"0\x123" // expected-error {{invalid escape sequence '\x123' in an unevaluated string literal}}
----------------
hubert.reinterpretcast wrote:
> I doubt that it is a problem, but Clang 16 accepted such hex escapes.
Yes, I only downgraded to a warning what you had reports about.
I haven't seen that pattern in the wild and i don't think anyone who would use that isn't confused on some level.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156596/new/
https://reviews.llvm.org/D156596
More information about the cfe-commits
mailing list