]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: optimize tsubst_template_decl for function templates
authorPatrick Palka <ppalka@redhat.com>
Mon, 18 Sep 2023 18:27:18 +0000 (14:27 -0400)
committerPatrick Palka <ppalka@redhat.com>
Mon, 18 Sep 2023 18:27:18 +0000 (14:27 -0400)
commit094091958654bae07a9ad53a63fd69468efcd3e3
treee08f4fb0e32ad865bacdd486633db3e594740d6b
parent0fb828af75732d39c644fd145c29d41ca14b8cb1
c++: optimize tsubst_template_decl for function templates

r14-2655-g92d1425ca78040 made instantiate_template avoid redundantly
performing a specialization lookup when calling tsubst_decl.  This patch
applies the same optimization to the analagous tsubst_template_decl when
(partially) instantiating a function template.  This allows us to remove
an early exit test from register_specialization since we no longer try
to register the FUNCTION_DECL corresponding to a function template
partial instantiation.

gcc/cp/ChangeLog:

* pt.cc (register_specialization): Remove now-unnecessary
early exit for FUNCTION_DECL partial instantiation.
(tsubst_template_decl): Pass use_spec_table=false to
tsubst_function_decl.  Set DECL_TI_ARGS of a non-lambda
FUNCTION_DECL specialization to the full set of arguments.
Simplify register_specialization call accordingly.

gcc/testsuite/ChangeLog:

* g++.dg/template/nontype12.C: Expect two instead of three
duplicate diagnostics for A<double>::bar() specialization.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/template/nontype12.C