[PATCH] D82880: Fix PR35677: UB on __int128_t or __uint128_t template parameters.
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 1 09:42:48 PDT 2020
riccibruno added a subscriber: aaron.ballman.
riccibruno added inline comments.
================
Comment at: clang/lib/AST/StmtPrinter.cpp:1159
+ case BuiltinType::UInt128:
+ OS << "Ui128";
+ break;
----------------
davidstone wrote:
> riccibruno wrote:
> > `i128` and `Ui128` are not valid integer literal suffix. The output of `StmtPrinter` is intended to be valid C++. Unfortunately here I think that your only choice is to print the high and low parts separately.
> I'm confused. i8, Ui8, i16, and Ui16 are also not valid C++ suffixes, but just a few lines up we use those. What am I missing here?
The literal suffixes `[u]i8, [u]i16, [u]i32, and [u]i64` are an MSVC extension (see `NumericLiteralParser::NumericLiteralParser` in `Lex/LiteralSupport.cpp`).
This does not explain why they are used even in non-ms compatibility mode
but at least there is some reason for their existence.
However I don't think that MSVC supports 128-bits integers (?), and clang certainly
does not support `[u]i128` so there is no reason to use them.
@aaron.ballman Do you know why are these suffixes used outside of ms-compatibility mode?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82880/new/
https://reviews.llvm.org/D82880
More information about the cfe-commits
mailing list