https://github.com/cor3ntin commented:

Thanks for working on this!
We are missing an instantiation scope when checking the satisfaction of nested 
requirements

```difff
@@ -7999,7 +7999,9 @@ concepts::Requirement *Sema::ActOnNestedRequirement(Expr 
*Constraint) {
 concepts::NestedRequirement *
 Sema::BuildNestedRequirement(Expr *Constraint) {
   ConstraintSatisfaction Satisfaction;
+  LocalInstantiationScope Scope(*this);
   if (!Constraint->isInstantiationDependent() &&
+      !Constraint->isValueDependent() &&
       CheckConstraintSatisfaction(nullptr, AssociatedConstraint(Constraint),
                                   /*TemplateArgs=*/{},
                                   Constraint->getSourceRange(), Satisfaction))
```

`CheckConstraintSatisfaction` already takes care to check that individual 
atomic constraints are constant expressions, but without an instantiation 
context this check in `TemplateInstantiator::TransformDecl` fails and we hit an 
assert later on.

```cpp
if (ParmVarDecl *PVD = dyn_cast<ParmVarDecl>(D);
      PVD && SemaRef.CurrentInstantiationScope &&
      (SemaRef.inConstraintSubstitution() ||
       SemaRef.inParameterMappingSubstitution()) &&
      maybeInstantiateFunctionParameterToScope(PVD))
    return nullptr;
```

https://github.com/llvm/llvm-project/pull/169876
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to