]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: tweak to (*(fn))() patch [PR104618]
authorJason Merrill <jason@redhat.com>
Mon, 28 Feb 2022 16:05:34 +0000 (12:05 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 7 Mar 2022 23:32:39 +0000 (18:32 -0500)
Other callers of mark_single_function might also want to look through these
wrapapers.

PR c++/104618

gcc/cp/ChangeLog:

* decl2.cc (mark_single_function): Look through parens and location
wrapper.
* typeck.cc (cp_build_addr_expr_1): Not here.

gcc/cp/decl2.cc
gcc/cp/typeck.cc

index 22edc2ba7f942db4d9e2cf107b4a93d0fefd61d3..e85bb87c9552d6fae1fe959b84a18a5d1d1e82a0 100644 (file)
@@ -5737,6 +5737,9 @@ decl_dependent_p (tree decl)
 bool
 mark_single_function (tree expr, tsubst_flags_t complain)
 {
+  expr = maybe_undo_parenthesized_ref (expr);
+  expr = tree_strip_any_location_wrapper (expr);
+
   if (is_overloaded_fn (expr) == 1
       && !mark_used (expr, complain)
       && (complain & tf_error))
index bddc83759adec208cb307b171c2d5d8de87c4537..ea6a485bbbf65055872340857a3173239ce4a8f0 100644 (file)
@@ -6884,9 +6884,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
      so we can just form an ADDR_EXPR with the correct type.  */
   if (processing_template_decl || TREE_CODE (arg) != COMPONENT_REF)
     {
-      tree stripped_arg
-       = tree_strip_any_location_wrapper (maybe_undo_parenthesized_ref (arg));
-      if (!mark_single_function (stripped_arg, complain))
+      if (!mark_single_function (arg, complain))
        return error_mark_node;
       val = build_address (arg);
       if (TREE_CODE (arg) == OFFSET_REF)