https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93822
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-8 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:487f16a7f2a6f849497a0d2f8fff61225e2270f6 commit r8-10272-g487f16a7f2a6f849497a0d2f8fff61225e2270f6 Author: Jason Merrill <ja...@redhat.com> Date: Mon May 25 18:38:09 2020 -0400 c++: generic lambda and -fsanitize=vla-bound [PR93822] Within the generic lambda the VLA capture proxy VAR_DECL has DECL_VALUE_EXPR which is a NOP_EXPR to the VLA type of the proxy. The problem here was that when instantiating we were tsubsting that type twice, once for the type of the DECL and once for the type of the NOP_EXPR, and getting two different (though equivalent) types. Then gimplify_type_sizes fixed up the type of the DECL, but that didn't affect the type of the NOP_EXPR, leading to sadness. Fixed by directly reusing the type from the DECL. gcc/cp/ChangeLog 2020-05-01 Jason Merrill <ja...@redhat.com> PR c++/93822 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have the same type as the variable.