This is the mail archive of the gcc-patches@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]

Re: [C++ PATCH] Core issue #226: Default template arguments in function templates


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


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