https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95232
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:ef4e0c35546ba2c897613925c1d2485603ca3ab1 commit r11-880-gef4e0c35546ba2c897613925c1d2485603ca3ab1 Author: Jason Merrill <ja...@redhat.com> Date: Tue Jun 2 16:23:02 2020 -0400 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.