[PATCH] D99456: [C++2b] Support size_t literals

Anton Bikineev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 30 03:36:09 PDT 2021


AntonBikineev marked 3 inline comments as done.
AntonBikineev added inline comments.


================
Comment at: clang/lib/Lex/LiteralSupport.cpp:640
         isFloat16 = true;
         continue;
       }
----------------
rsmith wrote:
> Looks like this might fix [[ https://godbolt.org/z/9Pe4qr1c7 | incorrect acceptance ]] of `1.0f16f` and `1.0f16L` in CUDA mode too :)
Nice!


================
Comment at: clang/lib/Sema/SemaExpr.cpp:3895
       // be an unsigned int.
       bool AllowUnsigned = Literal.isUnsigned || Literal.getRadix() != 10;
 
----------------
I now begin to think that we should probably also prohibit things like 0x1234z to be implicitly interpreted as unsigned. Wdyt?


================
Comment at: clang/lib/Sema/SemaExpr.cpp:3997
       // does not fit in a signed long long, but has no U suffix.
       if (Ty.isNull()) {
         Diag(Tok.getLocation(), diag::ext_integer_literal_too_large_for_signed);
----------------
I think this branch should also be covered, since we probably don't want promotion from size_t to ULL but instead have a separate diagnostic that size_t is out-of-range. I've added another diagnostic and branch here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99456



More information about the cfe-commits mailing list