@@ -1864,7 +1864,10 @@ hash_placeholder_constraint (tree c)
static tree
tsubst_valid_expression_requirement (tree t, tree args, subst_info info)
{
- return tsubst_expr (t, args, info.complain, info.in_decl, false);
+ tree r = tsubst_expr (t, args, info.complain, info.in_decl, false);
+ if (convert_to_void (r, ICV_STATEMENT, info.complain) == error_mark_node)
+ return error_mark_node;
+ return r;
}
new file mode 100644
@@ -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);
+}
@@ -15,6 +15,6 @@ template <class X> concept bool C() {
}
int main() {
- static_assert(C<A>());
+ static_assert(!C<A>());
return 0;
}