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
* pt.c (check_default_tmpl_args): Don't check local types.
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);
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");
/* 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);
/* 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
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;
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]. */
/* 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;
/* 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. */
}
}
- if (primary)
+ if (is_primary)
{
tree parms = DECL_TEMPLATE_PARMS (tmpl);
int i;
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;