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] |
The attached patch implements the resolution to core issue #226, default template arguments in function templates, which has been part of the C++0x working paper for a few years:
In summary, unlike in C++98/03, default template arguments *are* allowed in C++0x function templates. There are some restrictions regarding what one can do with default template arguments for friend function templates, but otherwise the use of this feature is obvious, and the implementation relatively simple.
The patch below enables default template arguments for function templates only when the experimental C++0x mode is enabled (-std=c++0x). Once this patch goes in, I'll update the changes document for GCC 4.3.
Cheers, Doug
* 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.
Attachment:
def-temp-arg-in-func-temp.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |