On 10/19/2017 04:15 AM, Jakub Jelinek wrote:
Hi!

A recent change to check_return_expr resulted in
maybe_warn_about_returning_address_of_local being called also with
processing_template_decl.  The problem with that is that the function
relies on folding (fold_for_warn) which isn't performed at all when
processing_template_decl.  So, we have still ARRAY_REF for a local decl
that has pointer type, rather than the expected POINTER_PLUS_EXPR,
where ARRAY_REF would only remain if the variable was actually an array.

The following patch fixes that by not calling the function at all
when processing_template_decl like before.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2017-10-19  Jakub Jelinek  <ja...@redhat.com>

        PR c++/82600
        * typeck.c (check_return_expr): Don't call
        maybe_warn_about_returning_address_of_local in templates.


ok, thanks

nathan


--
Nathan Sidwell

Reply via email to