This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [PR c++/84943] allow folding of array indexing indirect_ref


On Mar 28, 2018, Jason Merrill <jason@redhat.com> wrote:

> It looks like cp_build_addr_expr_1 already calls mark_used for single
> static member functions, it should probably do the same for single
> non-member functions.

Hmm...  That existing call is suspicious, now that you point it out.

There's a switch before it that peels off BASELINK and takes OVL_FIRST
only, so we would be marking as used something other than what overload
resolution would select, and not marking what overload resolution would
ultimately select, *if* we marked anything.  But since we've peeled off
the baseline, the test

    if (processing_template_decl || TREE_CODE (arg) != COMPONENT_REF)
 
passes because FUNCTION_DECL is not COMPONENT_REF, and we call
build_address before we get a chance to mark anything.

I guess we could move the mark_used logic ahead in the function, but
whether or not it do the job will depend on whether cp_build_addr_expr_1
gets called again after template substitution and overload resolution.

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]