aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-pmf1.C
blob: 30d2b2d4a485399fed619162280c01f0a86a22cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Make sure that the requirement fails because a .* expression of function
// type can only be used in a call.

// { dg-do compile { target concepts } }

template<class D, class T>
constexpr decltype(auto) invoke(D (T::*pmd), T&& t)
  noexcept(noexcept(t.*pmd))
  requires requires { t.*pmd; }
 { return t.*pmd; }

char invoke(...);

struct A
{
  int f();
};

int main()
{
  static_assert(sizeof(invoke (&A::f, A())) == 1);
}