<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132825>132825</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Incomplete implementation of P2280 / CWG2517
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
brevzin
</td>
</tr>
</table>
<pre>
This example, taken from [CWG2517](https://cplusplus.github.io/CWG/issues/2517.html), is accepted by gcc but rejected by clang:
```cpp
template<typename ArrayType> concept LargeArray =
requires (ArrayType my_array) { requires my_array.size() > 5; };
struct Big {
constexpr int size() const { return 100; }
};
static_assert(LargeArray<Big>);
```
clang says:
```
<source>:8:15: error: static assertion failed
8 | static_assert(LargeArray<Big>);
| ^~~~~~~~~~~~~~~
<source>:8:15: note: because 'Big' does not satisfy 'LargeArray'
<source>:2:46: note: because 'my_array.size() > 5' would be invalid: constraint variable 'my_array' cannot be used in an evaluated context
2 | requires (ArrayType my_array) { requires my_array.size() > 5; };
| ^
```
Note that clang does accept this alternative formulation:
```cpp
template<typename ArrayType> concept LargeArray =
requires (ArrayType my_array) {
[](auto& r)
requires (r.size() > 5)
{
;
}(my_array);
};
```
Which... look. I love lambdas. Truly. They hold a special place in my heart. But there is a time and a place for them and I'd prefer this not be it.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VcGO2zYQ_ZrxZRBBHlor-6CD7V0HCxRFDwvsMaCokcWGElWSclY59NsLStp43W2K5BBChmQO583wzZBPeq_PHXMB2QGy-5UcQmNdUTq-fNXdqrTVWDw12iO_yLY3DHTEID9zh7WzLUJ2OD5_pGydQ3YPtG1C6D2IPdAJ6KR6M_j4S846NEOZaAt0Oj5_BDpp7wf2QKfonDShNUC7iK49SqW4D1xhOeJZKSyHgI7_ZLXMKSO7c4ySTs9dOj-q7yHdB257IwODOIax5062jHvn5Pg09gziAZXtIjz-Jt2ZJwu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