diff gcc/testsuite/g++.dg/cpp2a/concepts-pmf1.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pmf1.C	Mon May 25 07:50:57 2020 +0900
@@ -0,0 +1,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);
+}