================ @@ -1432,14 +1432,26 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { Diags.Report(TokLoc, DiagId); ++s; DigitsBegin = s; - SawOctalPrefix = true; + radix = 8; + s = SkipOctalDigits(s); + if (s == ThisTokEnd) { + // Done + } else if ((isHexDigit(*s) && *s != 'e' && *s != 'E' && *s != '.') && + !isValidUDSuffix(LangOpts, StringRef(s, ThisTokEnd - s))) { + Diags.Report(Lexer::AdvanceToTokenCharacter(TokLoc, s - ThisTokBegin, SM, + LangOpts), + diag::err_invalid_digit) + << StringRef(s, 1) << 1; + hadError = true; + } + // Other suffixes will be diagnosed by the caller. + return; } auto _ = llvm::make_scope_exit([&] { // If we still have an octal value but we did not see an octal prefix, // diagnose as being an obsolescent feature starting in C2y. - if (radix == 8 && LangOpts.C2y && !SawOctalPrefix && !hadError && - !IsSingleZero) + if (radix == 8 && LangOpts.C2y && !hadError && !IsSingleZero) ---------------- cor3ntin wrote:
Do we have tests showing `00.` , `01.` `0E1` etc do not produce extension warnings? https://github.com/llvm/llvm-project/pull/141695 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits