https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96926
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:187d0d5871b1fa572b0238b4989fa067df56778f commit r11-7287-g187d0d5871b1fa572b0238b4989fa067df56778f Author: Jason Merrill <ja...@redhat.com> Date: Sat Feb 13 00:40:11 2021 -0500 c++: Tuple of self-dependent classes [PR96926] When compiling this testcase, trying to resolve the initialization for the tuple member ends up recursively considering the same set of tuple constructor overloads, and since two of them separately depend on is_constructible, the one we try second fails to instantiate is_constructible because we're still in the middle of instantiating it the first time. Fixed by implementing an optimization that someone suggested we were already doing: if we see a non-template candidate that is a perfect match for all arguments, we can skip considering template candidates at all. It would be enough to do this only when LOOKUP_DEFAULTED, but it shouldn't hurt in other cases. gcc/cp/ChangeLog: PR c++/96926 * call.c (perfect_conversion_p): New. (perfect_candidate_p): New. (add_candidates): Ignore templates after a perfect non-template. gcc/testsuite/ChangeLog: PR c++/96926 * g++.dg/cpp0x/overload4.C: New test.