This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12672] Evals template defaults args that it should not


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]