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

    <tr>
        <th>Summary</th>
        <td>
            Crash inside TemplateInstantiator on complex constraint expressions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          alexander-shaposhnikov
      </td>
    </tr>
</table>

<pre>
    ```
template <class T1, class T2>
int foo(const T1 &t1, const T2 &t2)
  requires requires {
    { t1 < t2 };
    { t2 < t1 };
  }
{
  return 1;
}

template <class T3, class T4>
int foo(const T3 &t3, const T4 &t4)
  requires requires {
    { t3 + t4 };
  }
{
  return 2;
}
```
To reproduce the issue one has to reapply the changes from 
60bee9ff544541e83ffbd4be31923d0e8b644690 

p.s.
inside TransformRequiresExpr we seem to take care of E->getLocalParameters()
(see also https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaTemplateInstantiate.cpp#L1374) ,
but if the parameters are referenced inside Requirements we get into trouble.

cc: @erichkeane  

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlM2O5CYQx58GX0rTMoXbYx98mK-WIu0hSvoFAJfbZDA4gHdn3z7Cds90NllpR7IEVJWL-v8KkDGaiyPq2PGRHZ8LuaTRh05aepOup3AXRzn7ODrz6r8WyvffO1aX-1c-s_Ih0TRbmQiYeNJWxghnzvAJ9jky8bIFGpdg8J5ho72LCc4cGNZpC94suFqQYbv9AhDo78UEih8Tdv94dUJeQOJ5a0gI7P6ZiR-9uHn5D968Wqc3-QKlJTjg72EfQT-TKm6kVj-XKlZh4kZqtVqqT0rNeR4hVb8uBv9HzL8bePYQaA6-XzRBGglMjAuBdwSjjJCyW86z_b469SjdhSIMwU-wJahLRdQOw7GqjhWnRgyD6itFgrco-pIaVVdV3ZZwy3I-xMMVVjQ9wTlIFwcfpj92-S9vc4BvBJFoylUk-UqgZSDwA7zcMfFyofTFa2l_l0FOlChEhs07UYZNJAJpo4cxpTky8cDwxPB0MWlc1EH7ieHJ2q_X4W4O_i_SieFJWa8YniZpHMOTttJdcpDJxj9pkvtw3k_Eby4m6ZKRiQ56nhmKL1zc5-4Cw6etHrUkMMMKcX4vGLKeQAMFcpp62GHsDCZyKWYGF0pgXIYQ_KIsHW5Ras3EA7CqpGD0-ErSEeysi74TfStaWVDH64aLGhveFmOnjvq-rrHOTeK8LFvJm-ZIJHuq2rKnwnRYoigrLsojF6I9oO7bQSk88rYlrWTeb5LGHjK5gw-XYj03XY2cl4WVimxcXxVER9-2Q8UQ8yMTupW2Wi6RVaU1McWPLMkkS91TkHG80vgvZR_AO9B-mi29bVcqyHzr6G0OFKPxLhZLsN2nG7_WGRmeVh3_BAAA__8lIoxd">