https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117825

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I wonder if we just shouldn't call check_function_arguments at all from
cp_build_function_call_vec when complain doesn't contain tf_warning.
At least, build_over_call doesn't call it in that case.

So
--- gcc/cp/typeck.cc.jj 2025-01-02 11:47:10.437498434 +0100
+++ gcc/cp/typeck.cc    2025-01-03 18:30:06.530525112 +0100
@@ -4513,9 +4513,11 @@ cp_build_function_call_vec (tree functio

   /* Check for errors in format strings and inappropriately
      null parameters.  */
-  bool warned_p = check_function_arguments (input_location, fndecl, fntype,
-                                           nargs, argarray, NULL,
-                                           cp_comp_parm_types);
+  bool warned_p
+    = ((complain & tf_warning)
+       && check_function_arguments (input_location, fndecl, fntype,
+                                   nargs, argarray, NULL,
+                                   cp_comp_parm_types));

   ret = build_cxx_call (function, nargs, argarray, complain, orig_fndecl);

Reply via email to