https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117530
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:708c393774188d74399ec75ef20a522444b09f92 commit r14-11591-g708c393774188d74399ec75ef20a522444b09f92 Author: Jason Merrill <ja...@redhat.com> Date: Mon Apr 7 14:35:14 2025 -0400 c++: self-dependent alias template [PR117530] Here, instantiating B<short> means instantiating A<short>, which means instantiating B<short>. And then when we go to register the initial instantiation, it conflicts with the inner one. Fixed by checking after tsubst whether there's already something in the hash table. We already did something much like this in tsubst_decl, but that doesn't handle this case. PR c++/117530 gcc/cp/ChangeLog: * pt.cc (instantiate_template): Check retrieve_specialization after tsubst. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-uneval27.C: New test. (cherry picked from commit d034c78c7be613db3c25fddec1dd50222327117b)