--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 43886
work in progress
Here's the beginning of work for more general variably-modified type capture,
based on the approach of capturing and remapping all the uses of outer
automatic vars in the VLA type when the VLA variable is captured.
Another approach would be to handle this later, when we actually do something
that involves the dimensions; that could avoid some unnecessary captures, but
currently the uses of the variable dimensions are hidden in ARRAY_REF, so we'd
need to lower it to pointer arithmetic in affected cases.