constraints_satisfied_p already carefully checks dependence of template
arguments before proceeding with satisfaction, so the dependence check
in instantiate_alias_template is unnecessary and overly conservative.
Getting rid of it allows us to check satisfaction ahead of time in more
cases as in the below testcase.
gcc/cp/ChangeLog:
* pt.cc (instantiate_alias_template): Exit early upon
error from coerce_template_parms. Remove dependence test
guarding constraints_satisfied_p.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-alias6.C: New test.
args = coerce_template_parms (DECL_TEMPLATE_PARMS (tmpl),
args, tmpl, complain);
+ if (args == error_mark_node)
+ return error_mark_node;
/* FIXME check for satisfaction in check_instantiated_args. */
- if (flag_concepts
- && !any_dependent_template_arguments_p (args)
- && !constraints_satisfied_p (tmpl, args))
+ if (!constraints_satisfied_p (tmpl, args))
{
if (complain & tf_error)
{
--- /dev/null
+// Verify we can check satisfaction of a non-dependent member alias
+// template-id whose constraints don't depend on outer template
+// parameters ahead of time.
+// { dg-do compile { target c++20 } }
+
+template<class T>
+struct A {
+ template<int N> requires (N > 0)
+ using at = T;
+
+ void f() {
+ using ty1 = at<0>; // { dg-error "constraint" }
+ using ty2 = at<1>;
+ }
+};