https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99599
--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:2154bcd6d43cfd821ca70e1583880c4ed955355d commit r14-3809-g2154bcd6d43cfd821ca70e1583880c4ed955355d Author: Patrick Palka <ppa...@redhat.com> Date: Fri Sep 8 12:02:20 2023 -0400 c++: refine CWG 2369 satisfaction vs non-dep convs [PR99599] As described in detail in the PR, the CWG 2369 resolution has the surprising consequence of introducing constraint recursion in seemingly valid and innocent code. This patch attempts to fix this surpising behavior for the majority of problematic cases. Rather than checking satisfaction before _all_ non-dependent conversions, as specified by the CWG resolution, this patch makes us first check "safe" non-dependent conversions, then satisfaction, then followed by other non-dependent conversions. A conversion is considered "safe" if computing it is guaranteed to not induce template instantiation, and we conservatively determine this by checking for user-declared constructors (resp. conversion functions) in the parm (resp. arg) class type, roughly. PR c++/99599 gcc/cp/ChangeLog: * pt.cc (check_non_deducible_conversions): Add bool parameter passed down to check_non_deducible_conversion. (fn_type_unification): Call check_non_deducible_conversions an extra time before satisfaction with noninst_only_p=true. (conversion_may_instantiate_p): Define. (check_non_deducible_conversion): Add bool parameter controlling whether to compute only conversions that are guaranteed to not induce template instantiation. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-recursive-sat4.C: Make 'Int' non-aggregate in order to preserve intent of the testcase. * g++.dg/cpp2a/concepts-nondep4.C: New test.