Skip to content
Snippets Groups Projects
user avatar
Patrick Palka authored
This simple patch extends the r12-3271-gf1e73199569287 optimization
to happen for deduction without explicit template arguments as well.
The motivation for this is to accept testcases such as conv20.C and
ttp40.C below, which don't use explicit template arguments but for
which unnecessary template instantiation during deduction could be
avoided if we uniformly pruned overloads according to arity early.
This incidentally causes us to accept one reduced testcase from
PR c++/84075, but the underlying issue there remains at large.

As a nice side effect, this change causes the "candidate expects N
argument(s)" note during overload resolution failure to point to the
template candidate instead of the call site, which seems like an
improvement along the lines of r14-309-g14e881eb030509.

gcc/cp/ChangeLog:

	* call.cc (add_template_candidate_real): Check arity even
	when there are no explicit template arguments.  Combine the
	two adjacent '!obj' tests into one.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/vt-57397-1.C: Expect "candidate expects ... N
	argument(s)" at the declaration site instead of the call site.
	* g++.dg/cpp0x/vt-57397-2.C: Likewise.
	* g++.dg/overload/template5.C: Likewise.
	* g++.dg/template/local6.C: Likewise.
	* g++.dg/template/conv20.C: New test.
	* g++.dg/template/ttp40.C: New test.
155178cc
History
This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.