pt.c (check_default_tmpl_args): Change is_primary and is_partial parameters to bool type, adjust.

2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

	* pt.c (check_default_tmpl_args): Change is_primary and is_partial
	parameters to bool type, adjust.
	(push_template_decl_real): Tidy.
	* parser.c (cp_parser_init_declarator): Adjust.
	* decl.c (redeclaration_error_message): Likewise.
	* cp-tree.h (check_default_tmpl_args): Update prototype.

From-SVN: r190013
This commit is contained in:
Paolo Carlini 2012-07-31 13:57:23 +00:00 committed by Paolo Carlini
parent b4e209fd1a
commit 86d4e13f06
5 changed files with 26 additions and 17 deletions

View file

@ -1,3 +1,12 @@
2012-07-31 Paolo Carlini <paolo.carlini@oracle.com>
* pt.c (check_default_tmpl_args): Change is_primary and is_partial
parameters to bool type, adjust.
(push_template_decl_real): Tidy.
* parser.c (cp_parser_init_declarator): Adjust.
* decl.c (redeclaration_error_message): Likewise.
* cp-tree.h (check_default_tmpl_args): Update prototype.
2012-07-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53624

View file

@ -5328,7 +5328,7 @@ extern tree process_template_parm (tree, location_t, tree,
extern tree end_template_parm_list (tree);
extern void end_template_decl (void);
extern tree maybe_update_decl_type (tree, tree);
extern bool check_default_tmpl_args (tree, tree, int, int, int);
extern bool check_default_tmpl_args (tree, tree, bool, bool, int);
extern tree push_template_decl (tree);
extern tree push_template_decl_real (tree, bool);
extern bool redeclare_class_template (tree, tree);

View file

@ -2480,7 +2480,8 @@ redeclaration_error_message (tree newdecl, tree olddecl)
if ((cxx_dialect != cxx98)
&& TREE_CODE (ot) == FUNCTION_DECL && DECL_FRIEND_P (ot)
&& !check_default_tmpl_args (nt, DECL_TEMPLATE_PARMS (newdecl),
/*is_primary=*/1, /*is_partial=*/0,
/*is_primary=*/true,
/*is_partial=*/false,
/*is_friend_decl=*/2))
return G_("redeclaration of friend %q#D "
"may not have default template arguments");

View file

@ -15849,8 +15849,8 @@ cp_parser_init_declarator (cp_parser* parser,
/* 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);
check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/true,
/*is_partial=*/false, /*is_friend_decl=*/1);
if (!friend_p && pushed_scope)
pop_scope (pushed_scope);

View file

@ -4210,10 +4210,9 @@ process_partial_specialization (tree decl)
/* Check that a template declaration's use of default arguments and
parameter packs is not invalid. Here, PARMS are the template
parameters. IS_PRIMARY is nonzero if DECL is the thing declared by
a primary template. IS_PARTIAL is nonzero if DECL is a partial
parameters. IS_PRIMARY is true if DECL is the thing declared by
a primary template. IS_PARTIAL is true if DECL is a partial
specialization.
IS_FRIEND_DECL is nonzero if DECL is a friend function template
declaration (but not a definition); 1 indicates a declaration, 2
@ -4223,8 +4222,8 @@ process_partial_specialization (tree decl)
Returns TRUE if there were no errors found, FALSE otherwise. */
bool
check_default_tmpl_args (tree decl, tree parms, int is_primary,
int is_partial, int is_friend_decl)
check_default_tmpl_args (tree decl, tree parms, bool is_primary,
bool is_partial, int is_friend_decl)
{
const char *msg;
int last_level_to_check;
@ -4456,8 +4455,8 @@ push_template_decl_real (tree decl, bool is_friend)
tree args;
tree info;
tree ctx;
int primary;
int is_partial;
bool is_primary;
bool is_partial;
int new_template_p = 0;
/* True if the template is a member template, in the sense of
[temp.mem]. */
@ -4499,11 +4498,11 @@ push_template_decl_real (tree decl, bool is_friend)
/* A friend template that specifies a class context, i.e.
template <typename T> friend void A<T>::f();
is not primary. */
primary = 0;
is_primary = false;
else
primary = template_parm_scope_p ();
is_primary = template_parm_scope_p ();
if (primary)
if (is_primary)
{
if (DECL_CLASS_SCOPE_P (decl))
member_template_p = true;
@ -4556,7 +4555,7 @@ push_template_decl_real (tree decl, bool is_friend)
/* Check to see that the rules regarding the use of default
arguments are not being violated. */
check_default_tmpl_args (decl, current_template_parms,
primary, is_partial, /*is_friend_decl=*/0);
is_primary, is_partial, /*is_friend_decl=*/0);
/* Ensure that there are no parameter packs in the type of this
declaration that have not been expanded. */
@ -4773,7 +4772,7 @@ template arguments to %qD do not match original template %qD",
}
}
if (primary)
if (is_primary)
{
tree parms = DECL_TEMPLATE_PARMS (tmpl);
int i;
@ -4815,7 +4814,7 @@ template arguments to %qD do not match original template %qD",
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
else
{
if (primary && !DECL_LANG_SPECIFIC (decl))
if (is_primary && !DECL_LANG_SPECIFIC (decl))
retrofit_lang_decl (decl);
if (DECL_LANG_SPECIFIC (decl))
DECL_TEMPLATE_INFO (decl) = info;