[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 06:59:39 PDT 2022


aaron.ballman added a subscriber: cor3ntin.
aaron.ballman added inline comments.


================
Comment at: clang/test/AST/Interp/arrays.cpp:135
+  static_assert(u32[1] == U'b', "");
+};
+
----------------
shafik wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > I think you need a more coverage for character literals. Some test cases that are interesting: multichar literals (`'abcd'`), character literals with UCNs (`'\uFFFF'`), character literals with numeric escapes (`'\xFF'`). I'm especially interested in seeing whether we handle integer promotions properly, especially when promoting to `unsigned int`.
> > I added two more test cases but I'm generally not that familiar with character  literal edge cases and integer promotion, so if you have concrete test cases in mind, that would be great :)
> We can find GNU documentation of multi-char literals here: https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior and I believe we follow the same scheme. 
> 
> There are some weird cases like `'\8'` which compilers seem to treat consistently but generate a diagnostic for.
CC @tahonermann and @cor3ntin as text encoding code owners -- they likely know all the worst test cases to be thinking about in this space.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135366/new/

https://reviews.llvm.org/D135366



More information about the cfe-commits mailing list