diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-07-31 13:57:23 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-07-31 13:57:23 +0000 |
commit | 86d4e13f065e69c61a7d40403431a604e9528864 (patch) | |
tree | 8104afa508ae2eea92c618f115950f7f8ed1963a /gcc/cp | |
parent | b4e209fd1ad2bcceed90e8849e1ba903121013b4 (diff) | |
download | gcc-86d4e13f065e69c61a7d40403431a604e9528864.zip gcc-86d4e13f065e69c61a7d40403431a604e9528864.tar.gz gcc-86d4e13f065e69c61a7d40403431a604e9528864.tar.bz2 |
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
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 25 |
5 files changed, 26 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8604169..8c2272e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,14 @@ 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. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3c1a7bf..ec33d92 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8e95a06..b637643 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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"); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 70d6dac..d8c3305 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 31ae3ef..6257502 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; |