]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: use iloc_sentinel in another place
authorJason Merrill <jason@redhat.com>
Sat, 28 Aug 2021 02:59:48 +0000 (22:59 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 31 Aug 2021 16:17:44 +0000 (12:17 -0400)
Another place we can use iloc_sentinel instead of explicitly saving and
restoring input_location.

gcc/cp/ChangeLog:

* constexpr.c (explain_invalid_constexpr_fn): Use iloc_sentinel.

gcc/cp/constexpr.c

index 8be88dcfc24fa11b8b91bd20b5db73126bdcc37f..45adbab485ab1ace70c99643d52b9f123f051f5b 100644 (file)
@@ -942,7 +942,6 @@ explain_invalid_constexpr_fn (tree fun)
 {
   static hash_set<tree> *diagnosed;
   tree body;
-  location_t save_loc;
   /* Only diagnose defaulted functions, lambdas, or instantiations.  */
   if (!DECL_DEFAULTED_FN (fun)
       && !LAMBDA_TYPE_P (CP_DECL_CONTEXT (fun))
@@ -957,7 +956,7 @@ explain_invalid_constexpr_fn (tree fun)
     /* Already explained.  */
     return;
 
-  save_loc = input_location;
+  iloc_sentinel ils = input_location;
   if (!lambda_static_thunk_p (fun))
     {
       /* Diagnostics should completely ignore the static thunk, so leave
@@ -985,7 +984,6 @@ explain_invalid_constexpr_fn (tree fun)
            cx_check_missing_mem_inits (DECL_CONTEXT (fun), body, true);
        }
     }
-  input_location = save_loc;
 }
 
 /* Objects of this type represent calls to constexpr functions