https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92106
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Marek Polacek from comment #2) > 9351 /* When returning address of a structured binding, if the > structured > 9352 binding is not a reference, continue normally, if it is a > 9353 reference, recurse on the initializer of the structured > 9354 binding. */ > 9355 tree base = DECL_DECOMP_BASE (whats_returned); > 9356 if (TYPE_REF_P (TREE_TYPE (base))) > 9357 { > 9358 tree init = DECL_INITIAL (base); > 9359 return maybe_warn_about_returning_address_of_local > (init); > 9360 } > > init is null here and cp_fold crashes on that. I'd add && DECL_INITIAL (base) to line 9356. Maybe it would be better to add return nullptr; to find if the range for loop has no iterations.