rsmith added inline comments.
================
Comment at: clang/lib/AST/TemplateBase.cpp:111-115
+ Out << "u8'" << Val << "'";
+ else if (T->isUnsignedIntegerType() && T->isChar16Type())
+ Out << "u16'" << Val << "'";
+ else if (T->isUnsignedIntegerType() && T->isChar32Type())
+ Out << "u32'" << Val << "'";
----------------
reikdas wrote:
> rsmith wrote:
> > This isn't correct: `u8'x'` will print as `u8'120'`. Perhaps you can factor
> > code to do this properly out of `StmtPrinter::VisitCharacterLiteral`.
> >
> > Also, the prefix for `char16_t` literals is `u`, not `u16`, and the prefix
> > for `char32_t` literals is `U`, not `u32`.
> > This isn't correct: `u8'x'` will print as `u8'120'`. Perhaps you can factor
> > code to do this properly out of `StmtPrinter::VisitCharacterLiteral`.
>
> I partially addressed this comment. I wasn't able to find a suitable example
> to test `u8'x'` being printed as `u8'120'`. @rsmith could you please help me
> by showing me a reproducer?
>
>
You'll need a C++20 test (or a test using `-fchar8_t`). Then:
```
template<auto> struct A {};
A<u8'x'>::B b; // expected-error {{no type named 'B' in 'A<u8'x'>'}}
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77598/new/
https://reviews.llvm.org/D77598
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits