Issue |
81699
|
Summary |
Errors in lambdas inside requires expressions should be hard errors
|
Labels |
new issue
|
Assignees |
|
Reporter |
BobBugs
|
According to [P0315r4 §2.9](https://wg21.link/P0315r4#Item.12) lambdas in `requires` expressions should behave the same as in SFINAE, i.e. _“the body of a lambda is not part of the immediate context”_. Therefore, the following should not compile:
```c++
template <class T>
concept V = requires {
[] { T x; };
};
int main() {
return V<void>;
}
```
Clang 17.0.1 erroneously compiles it. `V<void>` evaluates to `false` as if this would be a soft error. [Demo](https://godbolt.org/z/vEz911G3P).
The same thing in SFINAE is treated as a hard error, as it should be (see [C++20 \[temp.deduct.general\]/9](https://timsong-cpp.github.io/cppwp/n4868/temp.deduct.general#9)). [Demo](https://godbolt.org/z/Pb974xdP5).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs