aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-09-02 16:47:37 -0400
committerJason Merrill <jason@redhat.com>2020-12-10 15:36:15 -0500
commit3cf63c94df4712569e0ab996155013a3a043bed3 (patch)
treeace8cabaa9a8553b576a222edb7e245246d67623 /gcc/cp/parser.c
parent445430e16bd08ade34637d2346ded40dd49de508 (diff)
downloadgcc-3cf63c94df4712569e0ab996155013a3a043bed3.zip
gcc-3cf63c94df4712569e0ab996155013a3a043bed3.tar.gz
gcc-3cf63c94df4712569e0ab996155013a3a043bed3.tar.bz2
c++: Add make_temp_override generator functions
A common pattern before C++17 is the generator function, used to avoid having to specify the type of a container element by using a function call to get type deduction; for example, std::make_pair. C++17 added class type argument deduction, making generator functions unnecessary for many uses, but GCC won't be written in C++17 for years yet. gcc/cp/ChangeLog: * cp-tree.h (struct type_identity): New. (make_temp_override): New. * decl.c (grokdeclarator): Use it. * except.c (maybe_noexcept_warning): Use it. * parser.c (cp_parser_enum_specifier): Use it. (cp_parser_parameter_declaration_clause): Use it. (cp_parser_gnu_attributes_opt): Use it. (cp_parser_std_attribute): Use it.
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 39957d4..7ea8c28 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -19732,7 +19732,7 @@ cp_parser_enum_specifier (cp_parser* parser)
bool is_unnamed = false;
tree underlying_type = NULL_TREE;
cp_token *type_start_token = NULL;
- temp_override<bool> cleanup (parser->colon_corrects_to_scope_p, false);
+ auto cleanup = make_temp_override (parser->colon_corrects_to_scope_p, false);
/* Parse tentatively so that we can back up if we don't find a
enum-specifier. */
@@ -23381,7 +23381,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser,
cp_token *token;
bool ellipsis_p;
- temp_override<bool> cleanup
+ auto cleanup = make_temp_override
(parser->auto_is_implicit_function_template_parm_p);
if (!processing_specialization
@@ -27488,7 +27488,7 @@ cp_parser_gnu_attributes_opt (cp_parser* parser)
{
tree attributes = NULL_TREE;
- temp_override<bool> cleanup
+ auto cleanup = make_temp_override
(parser->auto_is_implicit_function_template_parm_p, false);
while (true)
@@ -27688,7 +27688,7 @@ cp_parser_std_attribute (cp_parser *parser, tree attr_ns)
tree attribute, attr_id = NULL_TREE, arguments;
cp_token *token;
- temp_override<bool> cleanup
+ auto cleanup = make_temp_override
(parser->auto_is_implicit_function_template_parm_p, false);
/* First, parse name of the attribute, a.k.a attribute-token. */