https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93822
--- Comment #3 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:bcbf334afe091ad7d0f5ffe164299f8730cf41d1 commit r11-15-gbcbf334afe091ad7d0f5ffe164299f8730cf41d1 Author: Jason Merrill <ja...@redhat.com> Date: Fri May 1 13:53:32 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.