[clang] [clang] Implement P3176R1: The Oxford variadic comma (PR #117524)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 16:50:32 PST 2024


================
@@ -8119,6 +8119,14 @@ void Parser::ParseParameterDeclarationClause(
     }
 
     if (TryConsumeToken(tok::ellipsis, EllipsisLoc)) {
+      if (getLangOpts().CPlusPlus26) {
+        // C++26 [dcl.dcl.fct]p3:
+        //   A parameter-declaration-clause of the form
+        //   parameter-list '...' is deprecated
+        Diag(EllipsisLoc, diag::warn_deprecated_missing_comma_before_ellipsis)
+            << FixItHint::CreateInsertion(EllipsisLoc, ", ");
+      }
+
----------------
antangelo wrote:

I had intended to fallthrough to those if blocks so that the `else if (ParmDeclarator.getEllipsisLoc().isValid() || Actions.containsUnexpandedParameterPacks(ParmDeclarator))` block would be evaluated to also emit the parameter pack diagnostics. Do you think those should be omitted in this case?

https://github.com/llvm/llvm-project/pull/117524


More information about the cfe-commits mailing list