Issue |
132825
|
Summary |
Incomplete implementation of P2280 / CWG2517
|
Labels |
new issue
|
Assignees |
|
Reporter |
brevzin
|
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs