diff options
author | Douglas Gregor <doug.gregor@gmail.com> | 2007-03-28 14:05:29 +0000 |
---|---|---|
committer | Doug Gregor <dgregor@gcc.gnu.org> | 2007-03-28 14:05:29 +0000 |
commit | 9b7dd5e868e5c3978ea8c6cfef383c2846321ddf (patch) | |
tree | c72b508351bff91028912e57668dee64204baa72 /gcc/cp/parser.c | |
parent | e701c05c17884fb38917e613f42b000e57bacc57 (diff) | |
download | gcc-9b7dd5e868e5c3978ea8c6cfef383c2846321ddf.zip gcc-9b7dd5e868e5c3978ea8c6cfef383c2846321ddf.tar.gz gcc-9b7dd5e868e5c3978ea8c6cfef383c2846321ddf.tar.bz2 |
decl.c (redeclaration_error_message): Complain when redeclaring a friend function with default template arguments...
2007-03-28 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.
2007-03-28 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.
From-SVN: r123300
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ec90726..da573cb 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11721,6 +11721,13 @@ cp_parser_init_declarator (cp_parser* parser, ((is_parenthesized_init || !is_initialized) ? 0 : LOOKUP_ONLYCONVERTING)); } + else if (flag_cpp0x && friend_p && decl && TREE_CODE (decl) == FUNCTION_DECL) + /* Core issue #226 (C++0x only): A default template-argument + shall not be specified in a friend class template + declaration. */ + check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/1, + /*is_partial=*/0, /*is_friend_decl=*/1); + if (!friend_p && pushed_scope) pop_scope (pushed_scope); |