<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64607>64607</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang crashes with requires expression in lambda in concept constraints
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
namniav
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/Kvr6afWd4
```c++
template<typename T> concept doesnt_matter = true;
template<class T>
concept test =
[]{
return requires(T t) {
{ t } -> doesnt_matter;
};
}();
static_assert(test<int>);
```
It is reduced from https://godbolt.org/z/5K6janbx5
```c++
#include <concepts>
#include <type_traits>
#include <utility>
#include <tuple>
template<class T>
concept tuple_like =
[] <std::size_t...I> (std::index_sequence<I...>) {
return ((requires(T t) {
{ std::get<I>(t) } -> std::convertible_to<std::tuple_element_t<I, T>&>;
}) && ...);
} (std::make_index_sequence<std::tuple_size_v<T>>{});
static_assert(tuple_like<std::tuple<int>>);
```
Both were accepted by Clang 15 and earlier. Clang 16 and current trunk on CompilerExplorer crashes on them(with either libc++ or libstdc++), but accepts the second if `std::tuple_element_t<I, T>&` is replaced with `int&`.
GCC also has this issue on the second example only: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105644.
MSVC accepts them.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVclu4zgQ_Rr6UoggUTYtH3xI7HgQNOY0jZmjQFEViR2KVJOlbF8_oCQvibvRMQTbKrK2916RMgTdWMQtW92x1X4hB2qd31rZWS2fF5Wr37YtUR9Yfsv4gfFD4-rKGUqcbxg_vDN--PbshXz8r16ydM_SWybS6VGM38VntBJ2vZGELN_RW49WdgjfWX4PylmFPUHtMFgqO0mEHli-B_IDsnz2v4qijAxhDDEtHeMQBhrdJzMAwNQbW9-dTfHjkQZvwePPQXsMjBffgRjfwNXOMcj6DgjYeg83sewP5Z6qPG_en23xh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