This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Core issue #226: Default template arguments in function templates
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Doug Gregor <doug dot gregor at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 28 Mar 2007 12:44:47 +0100
- Subject: Re: [C++ PATCH] Core issue #226: Default template arguments in function templates
- References: <24b520d20703270624m65e1e7f2t63980a83ebed317c@mail.gmail.com>
Doug Gregor wrote:
2007-03-27 Douglas Gregor <doug.gregor@gmail.com>
* g++.dg/cpp0x/temp_default1.C: New.
* g++.dg/cpp0x/temp_default3.C: New.
* g++.dg/cpp0x/temp_default2.C: New.
* g++.dg/cpp0x/temp_default4.C: New.
2007-03-27 Douglas Gregor <doug.gregor@gmail.com>
* decl.c (redeclaration_error_message): Complain when redeclaring
a friend function with default template arguments (C++0x mode only).
* cp-tree.h (check_default_tmpl_args): Declare.
* pt.c (check_default_tmpl_args): In C++0x mode, permit default
template arguments in function templates. Add support for checking
the default template arguments of friend templates.
(push_template_decl_real): Fix call to check_default_tmpl_args.
(type_unification_real): If a template parameter has not been
deduced but provides a default template argument, substitute into
that default template argument.
* parser.c (cp_parser_init_declarator): When declaring (but not
defining!) a function template in C++0x mode, check for default
template arguments.
this looks good, but ...
@@ -11346,6 +11374,23 @@ type_unification_real (tree tparms,
&& !saw_undeduced++)
goto again;
+ /* Core issue #226 (C++0x) [temp.deduct]:
+
+ If a template argument has not been deduced, its
+ default template argument, if any, is used. */
+ if (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)))
+ {
shouldn't that be protected with flag_cpp0x too?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk