[clang] Diagnose the code with trailing comma in the function call. (PR #125232)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 31 07:40:26 PST 2025
================
@@ -2237,6 +2237,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
if (PP.isCodeCompletionReached() && !CalledSignatureHelp)
RunSignatureHelp();
LHS = ExprError();
+ } else if (!HasError && HasTrailingComma) {
+ // FIXME: add a FIXIT to remove the trailing comma.
+ Diag(Tok, diag::err_extraneous_trailing_comma);
----------------
cor3ntin wrote:
I think we should just reuse `err_expected_expression`. The important point here is that there is a diagnostic.
Note sure this happens often enough to warrant a fixit
https://github.com/llvm/llvm-project/pull/125232
More information about the cfe-commits
mailing list