gcc/testsuite/g++.dg/cpp2a/concepts-pmf1.C
raw| 1 | // Make sure that the requirement fails because a .* expression of function |
| 2 | // type can only be used in a call. |
| 3 | |
| 4 | // { dg-do compile { target concepts } } |
| 5 | |
| 6 | template<class D, class T> |
| 7 | constexpr decltype(auto) invoke(D (T::*pmd), T&& t) |
| 8 | noexcept(noexcept(t.*pmd)) |
| 9 | requires requires { t.*pmd; } |
| 10 | { return t.*pmd; } |
| 11 | |
| 12 | char invoke(...); |
| 13 | |
| 14 | struct A |
| 15 | { |
| 16 | int f(); |
| 17 | }; |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | static_assert(sizeof(invoke (&A::f, A())) == 1); |
| 22 | } |