c++: Fix VLA in template [PR95232]
In a non-template, grokdeclarator notices when we build a pointer to a
variably-modified type, and inserts a TYPE_DECL to make sure that type gets
gimplified. But in a template we can't always recognize a variably-modified
type, so we need to deal with it at instantiation time.
gcc/cp/ChangeLog:
PR c++/95232
* cp-tree.h (predeclare_vla): Declare.
* cp-gimplify.c (predeclare_vla): Handle getting a decl.
* pt.c (tsubst_expr) [DECL_EXPR]: Use it.
gcc/testsuite/ChangeLog:
PR c++/95232
* g++.dg/ubsan/vla-2.C: New test.