Debian Codegraph @

libstdc++-v3/testsuite/20_util/function_objects/invoke/dangling_ref.cc

raw
1 // { dg-do compile { target c++23 } }
2 #include <functional>
3
4 int f();
5
6 template<typename R>
7 concept can_invoke = requires (int (&f)()) { std::invoke_r<R>(f); };
8
9 static_assert( not can_invoke<const int&> );
10 static_assert( not can_invoke<int&&> );
11 static_assert( not can_invoke<const long&> );