https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100946
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:ae96e217ef82502312bed7e195a30ca5c67ca7ef commit r11-8549-gae96e217ef82502312bed7e195a30ca5c67ca7ef Author: Patrick Palka <ppa...@redhat.com> Date: Thu Jun 10 18:31:18 2021 -0400 c++: normalization of non-templated return-type-req [PR100946] Here the satisfaction cache is conflating the satisfaction value of the two return-type-requirements because the corresponding constrained 'auto's have level 2, but they capture an empty current_template_parms. This ultimately causes the satisfaction cache to think the type constraint doesn't depend on the deduced type of the expression. When normalizing the constraints on an 'auto', the assumption made by normalize_placeholder_type_constraints is that the level of the 'auto' is one greater than the depth of the captured current_template_parms, an assumption which is not holding here. So this patch just makes n_p_t_c adjust the normalization context appropriately in this situation. PR c++/100946 gcc/cp/ChangeLog: * constraint.cc (normalize_placeholder_type_constraints): When normalizing a non-templated return-type-requirement, add a dummy level to initial_parms. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-return-req3.C: New test. (cherry picked from commit 206db06ee380f490db0293af4ea7a4d590abd78c)