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 19:39:48 +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 #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Template argument deduction requires substituting the template arguments where
they appear. If that is in the return type, it gets substituted into the return
type. If that causes a substitution error then deduction fails (that is how
using enable_if on the return type works, it *must* consider the return type
during argument deduction for that to work!). If it causes an error outside
the immediate context you get an error, not deduction failure (14.8.2 p8).