[PATCH] D99456: [C++2b] Support size_t literals
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 30 15:17:38 PDT 2021
rsmith accepted this revision.
rsmith added a comment.
Thanks! Looks good to me. Please wait a day or so in case Aaron has more comments before going ahead.
================
Comment at: clang/include/clang/Basic/DiagnosticCommonKinds.td:198-200
+def err_size_t_literal_too_large: Error<
+ "%select{signed |}0'size_t' literal is out of range of possible "
+ "%select{signed |}0'size_t' values">;
----------------
AntonBikineev wrote:
> rsmith wrote:
> > I wonder if it'd be better to say `'ssize_t'` instead of `signed 'size_t'` here? The latter sounds self-contradictory since `size_t` is an unsigned type.
> I thought about it (and actually had it first as ssize_t). The problem with ssize_t is that it's not defined by C or C++ Standards, AFAIK, but by POSIX. The proposal calls it "the signed integer type corresponding to std::size_t", so I decided to shorten it to "signed 'size_t'". However, I don't have strong opinion on this.
That makes sense. OK, I don't have a strong opinion either, so let's go with what you have.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:3996-3997
+ // If we still couldn't decide a type, we either have 'size_t' literal
+ // that is out of range or a literal that does not fit in a signed long
+ // long, but has no U suffix.
if (Ty.isNull()) {
----------------
(Mostly to make it clear that this can happen for `size_t` regardless of the `u` suffix.)
================
Comment at: clang/www/cxx_status.html:1273
<td><a href="https://wg21.link/p0330r8">P0330R8</a></td>
- <td class="none" align="center">No</td>
+ <td class="none" align="center">Clang 13</td>
</tr>
----------------
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