Here during partial substitution of the requires-expression (as part of
CTAD constraint rewriting) we segfault from the INDIRECT_REF case of
convert_to_void due *f(u) being type-dependent. We should just defer
checking convert_to_void until satisfaction.
PR c++/118060
gcc/cp/ChangeLog:
* constraint.cc (tsubst_valid_expression_requirement): Don't
check convert_to_void during partial substitution.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires40.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
{
tsubst_flags_t quiet = info.complain & ~tf_warning_or_error;
tree r = tsubst_expr (t, args, quiet, info.in_decl);
- if (convert_to_void (r, ICV_STATEMENT, quiet) != error_mark_node)
+ if (r != error_mark_node
+ && (processing_template_decl
+ || convert_to_void (r, ICV_STATEMENT, quiet) != error_mark_node))
return r;
if (info.diagnose_unsatisfaction_p ())
--- /dev/null
+// PR c++/118060
+// { dg-do compile { target c++20 } }
+
+int* f(int);
+
+template<class T>
+struct A {
+ template<class U> requires requires (U u) { *f(u); }
+ A(T, U);
+};
+
+A a{0, 0};