[PATCH] D156596: [Clang] Produce a warning instead of an error in unevaluated strings before C++26

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 12:41:44 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:290
+  "encoding prefix '%0' on an unevaluated string literal has no effect"
+  "%select{| and is incompatible with c++2c}1">,
+  InGroup<DiagGroup<"invalid-unevaluated-string">>;
----------------
hubert.reinterpretcast wrote:
> I am not seeing any tests covering C mode.
> 
> @aaron.ballman, can you confirm that you are okay with the warning when processing C code (and, moreover, the newly-added errors for numeric escape sequences)?
> 
Good call on C test coverage, thank you for bringing that up!

I think the behavior in C is reasonable, even if it's not mandated by the standard. We're going from issuing an error in C to issuing a warning and the warning text helpfully omits the C++2c part of the diagnostic, so it seems like we're more relaxed in C than we previously were.

Do you have concerns about the behavior in C? (Or are you saying you'd prefer this to be an error in C as it was before?)


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