[clang] [Clang][Parser] Add a warning to ambiguous uses of T...[N] types (PR #116332)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 04:56:45 PST 2024


================
@@ -253,6 +254,19 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
     if (Type.isNull())
       return false;
 
+    // C++ [cpp23.dcl.dcl-2]:
+    //   Previously, T...[n] would declare a pack of function parameters.
+    //   T...[n] is now a pack-index-specifier. [...] Valid C++ 2023 code that
+    //   declares a pack of parameters without specifying a declarator-id
+    //   becomes ill-formed.
+    //
+    // However, we still avoid parsing them as pack expansions because this is a
+    // rare use case of packs, despite being partway non-conforming, to ensure
+    // semantic consistency given that we have backported this feature.
----------------
zyn0217 wrote:

Good catch, fixed

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


More information about the cfe-commits mailing list