https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82600
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 42392 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42392&action=edit gcc8-pr82600.patch Untested fix. The problem is that the -Wreturn-local-addr implementation requires full folding of the expressions such that it will actually not see an ARRAY_REF if the corresponding DECL isn't an array, but a pointer. Such folding isn't performed if processing_template_decl though (no folding is done, cp_fully_fold just returns the passed argument immediately).