Issue 152734
Summary std::is_invocable_r incorrectly handle non-moveable parameters
Labels new issue
Assignees
Reporter T-Maxxx
    Consider following source code:
```cpp
#include <functional>
#include <iostream>

class foo final {
public:
    foo() = default;
    foo( const foo &other ) = delete;
 foo &operator=( const foo &other ) = delete;
    foo( foo &&other ) noexcept = delete;
    foo &operator=( foo &&other ) noexcept = delete;
    ~foo() noexcept = default;
};

using Foo = std::function<void( foo )>;
static_assert( std::is_invocable_v<Foo, foo> ); // <- Comment out to see output + return code 0.

void obviously_invocable( foo f )
{
 std::cout << "invoked" << std::endl;
}

int main() {
 obviously_invocable( {} );
    return 0;
}
```
Compilation with `-std=c++26 -O0 -stdlib=libc++` failed:
```bash
error: static assertion failed due to requirement 'std::is_invocable_v<std::function<void (foo)>, foo>'
   15 | static_assert( std::is_invocable_v<Foo, foo> ); // <- Comment out to see output + return code 0.
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Note 1: [try at godbolt](https://godbolt.org/z/Wee9j9q31)
Note 2: possibly linked with https://github.com/llvm/llvm-project/issues/55346
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to