On 10/15/19 2:41 PM, Jakub Jelinek wrote:
On Tue, Oct 15, 2019 at 02:28:12PM -0400, Marek Polacek wrote:
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1z/decomp50.C
@@ -0,0 +1,51 @@
+// PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
+// { dg-do compile { target c++17 } }
+
On Tue, Oct 15, 2019 at 02:28:12PM -0400, Marek Polacek wrote:
> --- /dev/null
> +++ gcc/testsuite/g++.dg/cpp1z/decomp50.C
> @@ -0,0 +1,51 @@
> +// PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
> +// { dg-do compile { target c++17 } }
> +
> +template struct B;
> +template
On Tue, Oct 15, 2019 at 07:34:31PM +0200, Jakub Jelinek wrote:
> On Tue, Oct 15, 2019 at 01:17:17PM -0400, Marek Polacek wrote:
> > 2019-10-15 Marek Polacek
> >
> > PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
> > * typeck.c
On Tue, Oct 15, 2019 at 01:17:17PM -0400, Marek Polacek wrote:
> 2019-10-15 Marek Polacek
>
> PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
> * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
> recursing on null initializer.
>
> *
Here we are returning the address of a structure binding and since it's a
reference, we recursed on its initializer, but in this case there was none
and we crashed in cp_fold. So don't recurse when we don't have an init to
recurse on.
Bootstrapped/regtested on x86_64-linux, ok for trunk/9?