Issue 74244
Summary Wrong answer in `requires` not using the parameter
Labels new issue
Assignees
Reporter JohelEGP
    See <https://cpp1.godbolt.org/z/hT8rqcfsT>:
```C++
template<class T> auto f() -> decltype([]<class Obj>(Obj obj) requires requires { obj.a(); }      // OK: `false`.
 || requires { Obj{}.a(); } // Wrong: `true`.
 {}(T{})) { }

template<class F, class T> concept invocable = requires(F f, T t) { f(t); };

static_assert(!invocable<decltype([]<class T>(T) -> decltype(f<T>()) {}), int>);
```
```output
<source>:7:15: error: static assertion failed due to requirement '!invocable<(lambda at <source>:7:35), int>'
    7 | static_assert(!invocable<decltype([]<class T>(T) -> decltype(f<T>()) {}), int>);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to