<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58368>58368</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Templated Lambda with requires clause defined inside concept crash when instantiated constraints.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            concepts
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            erichkeane
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          erichkeane
      </td>
    </tr>
</table>

<pre>
    As reported here: https://reviews.llvm.org/D126907 and reproduced here: https://cute.godbolt.org/z/Prh6xsesz

Lambdas that are defined inside of a concept and have a requires clause crash while instantiating their requires clause, because we don't add the concept's template arguments to the MultiLevelTemplateArgumentList.

Typically, we 'rebuild' the template argument lists by walking back through the instantiated Decls.  However in this case, the lambda is defined inside of a ConceptSpecializationExpr, which doesn't really exist inside of a decl-context-tree.  I'll have to figure out how to make the Expr a context for the purposes of rebuilding these template argument lists.

This gets more troublesome with nested lambdas, and it isn't clear when we might be off trying to instantiate a DIFFERENT dependency (that is, if the lambda's requires clause causes a different requires clause, outside of the concept to be evaluated).

I'm still looking at this, but want to capture this before the weekend.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1VNty2jAQ_Rr7RROPL2DgwQ9pCNPMpJ1Omx-QpbWtIluuLhDy9V3JJoFcZsCY1d7OObuqFT9Vt4ZoGJW2wEkHGqLilnTWjgZfonyHHw0HAUeTSHnoE6VbNG2zvNykK0IH7qO14o59Gc-chaRVvFbSzvEv-P2lu_LZgHmJ0m2U3k7PR9rXnBpiO2oJ1UA4NGLA1GIwggNRDaGEqYHBaEP1jh4ATRr-OaHBECapM0CYpqYjx05I8KGWDlZQK4YWM4PQ7_2j_I7UwELoEYuqIcpXWIBz738uiDbsDPpRUotFdet6GCyaVPD64aQVj3AA-TT73M4uj8LY5BLm02kUjEp58oWxIGbWUDshOb6FZB_KEIlJDKlP5Ej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