aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/except.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/except.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/except.c')
-rw-r--r--gcc/cp/except.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 0f6c76b..e76ade2 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1101,7 +1101,7 @@ maybe_noexcept_warning (tree fn)
&& (!DECL_IN_SYSTEM_HEADER (fn)
|| global_dc->dc_warn_system_headers))
{
- temp_override<bool> s (global_dc->dc_warn_system_headers, true);
+ auto s = make_temp_override (global_dc->dc_warn_system_headers, true);
auto_diagnostic_group d;
if (warning (OPT_Wnoexcept, "noexcept-expression evaluates to %<false%> "
"because of a call to %qD", fn))