https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71879
--- Comment #3 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:f645da0e4ab9438dfd0c047c710c7ec6a7d6d8f3 commit r11-6842-gf645da0e4ab9438dfd0c047c710c7ec6a7d6d8f3 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Jan 21 14:04:55 2021 -0500 c++: Fix excessive instantiation inside decltype [PR71879] Here after resolving the address of a template-id inside decltype, we end up instantiating the chosen specialization (from the call to mark_used in resolve_nondeduced_context), even though only its type is needed. This patch sets cp_unevaluated_operand throughout finish_decltype_type, so that in particular it's set during the call to resolve_nondeduced_context within. gcc/cp/ChangeLog: PR c++/71879 * semantics.c (finish_decltype_type): Set up a cp_unevaluated sentinel at the start of the function. Remove a now-redundant manual adjustment of cp_unevaluated_operand. gcc/testsuite/ChangeLog: PR c++/71879 * g++.dg/cpp0x/decltype-71879.C: New test.