[clang] [BitInt] Expose a _BitInt literal suffix in C++ (PR #86586)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 1 16:11:53 PDT 2024
================
@@ -1117,19 +1118,37 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
if (isImaginary) break; // Cannot be repeated.
isImaginary = true;
continue; // Success.
+ case '_':
+ if (isFPConstant)
+ break; // Invalid for floats
+ if (HasSize)
+ break;
+ if (possibleBitInt)
+ break; // Cannot be repeated.
+ if (LangOpts.CPlusPlus && s[1] == '_') {
+ // Scan ahead to find possible rest of BitInt suffix
+ for (const char *c = s; c != ThisTokEnd; ++c) {
+ if (*c == 'w' || *c == 'W') {
+ possibleBitInt = true;
+ ++s;
----------------
zygoloid wrote:
FYI, per CWG1810 / [over.literal]/1, it's now IFNDR rather than UB:
> Some literal suffix identifiers are reserved for future standardization; see [usrlit.suffix]. A declaration whose literal-operator-id uses such a literal suffix identifier is ill-formed, no diagnostic required.
... but that doesn't make a difference here. (The "NDR" part is just to allow implementations to permit the standard library to declare these literal operators.)
https://github.com/llvm/llvm-project/pull/86586
More information about the cfe-commits
mailing list