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

    <tr>
        <th>Summary</th>
        <td>
            [clang 16 & trunk][c++20] Crash when mixing iterator concepts and using-declarations in a requires expression
        </td>
    </tr>

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

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

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

<pre>
    After drawing some inspiration from [this Stackoverflow answer](https://stackoverflow.com/a/74659822), I decided to write up the following code that checks the presence of `begin()` and `end()` via ADL:

```
#include <concepts>
#include <iterator>
#include <vector>

template <typename T>
concept HasBeginEnd = []{
 using std::begin;
    using std::end;

    return requires(T& t)
 {
        {begin(t)} -> std::input_iterator;
        {end(t)} -> std::input_iterator;
 };
}();
static_assert(HasBeginEnd<std::vector<int>>);
```

This, however, crashes Clang 16 and trunk on Godbolt. Surprisingly, it appears that Clang 15 and older are not affected.

Godbolt link: https://godbolt.org/z/zndsGP63Y

Stacktrace generated: [stacktrace.txt](https://github.com/llvm/llvm-project/files/12016860/stacktrace.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEuT4jYQ_jXi0jWUkd8HH3gMm1TlkKqdS05bQmpjZYTkSG2Yya9PSeCB3ewehgJhq9_f190iBH20iB0rN6zcLcREg_OdkzR57ezi4NR7t-4JPSgvLtoeIbgTgrZh1F6QdhZ6707Ayg0NOsBXEvLVndH3xl1A2HBBz8od481ANAaWrxnfM74Pj3pL6U6M7wXj-7qoyrbhnPGW8S38DgqlVqiAHFy8JoRpBBoQemeMSwlJpxBoEARyQPkaknj0GNBKBNcDq7IDHrVlvIluqwyEVfEWrbrfnbWA9e6PmGG2Y9l8Vtnte33lubbSTAqB5VvprMSRAsuffybWhF6Q878Qn1F-J0wn4Wk0gpICvY9oxQnh5UPpFhF-E2ET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