[PATCH] D135366: [clang][Interp] Implement String- and CharacterLiterals
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 10 07:50:23 PDT 2022
cor3ntin added inline comments.
================
Comment at: clang/test/AST/Interp/arrays.cpp:135
+ static_assert(u32[1] == U'b', "");
+};
+
----------------
aaron.ballman wrote:
> 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.
Most weirdness are taken care of during lexing.
What is interesting to test during evaluation
* multi character literals ie `'abcd'`
* `u8` (utf8) and `u` literals (utf16)
Note that wide characters literals were removed from C++ so it's no longer a concern
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135366/new/
https://reviews.llvm.org/D135366
More information about the cfe-commits
mailing list