This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12672] Evals template defaults args that it should not
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 Jan 2016 11:24:11 +0000
- Subject: [Bug c++/12672] Evals template defaults args that it should not
- Auto-submitted: auto-generated
- References: <bug-12672-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12672
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Ivan Godard from comment #0)
> The problem seems to be that the compiler is not first pruning all
> candidates with the wrong number of formals before doing type matching.
Which is correct. The first thing it has to do is find the set of all the
candidate functions, *then* it determines the subset which are viable functions
("those that have the proper number of arguments and meet certain other
conditions").
13.3.1 says:
In each case where a candidate is a function template, candidate function
template specializations are generated using template argument deduction
(14.8.3, 14.8.2). Those candidates are then handled as candidate functions
in the usual way.124
Footnote 124 says:
124) The process of argument deduction fully determines the parameter types
of the function template specializations, i.e., the parameters of function
template specializations contain no template parameter types. Therefore,
except where specified otherwise, function template specializations and
non-template functions (8.3.5) are treated equivalently for the remainder
of overload resolution.
So to find the candidate functions template argument deduction is done on each
Foo, and that deduction results in an error outside the immediate context,
where SFINAE doesn't apply.