[clang] bug fix c++26 fail for function parameter packs (PR #198207)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 23 03:58:53 PDT 2026


================
@@ -911,6 +911,34 @@ bool Sema::CheckParameterPacksForExpansion(
     // Determine the size of this argument pack.
     unsigned NewPackSize, PendingPackExpansionSize = 0;
     if (IsVarDeclPack) {
+
+      // if there is a function paramter pack and we directly call findInstantiationOf
+      // then it fails because localdecls are not added to the instantiation scope until 
+      // after we check for pack expansions. So we need to check for parameter packs here 
+      // and add them to the instantiation scope before we call findInstantiationOf.
----------------
albertbolt1 wrote:

```mermaid
flowchart TD
    A[EvaluateSlow<br/>FoldExpandedConstraint] --> B[EvaluateFoldExpandedConstraintSize]
    
    B --> C[CheckParameterPacksForExpansion]
    
    C --> D{findInstantiationOf<br/>on booleans pack}
    
    D -->|Fails - not in scope| E[Returns nullptr]
    
    E --> F[ShouldExpand = false]
    
    F --> G[FAILURE<br/>Cannot determine pack size]
```

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


More information about the cfe-commits mailing list