https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:33a9c4dd5fcac7e3f5d835b35fe787126339dd2b commit r14-10357-g33a9c4dd5fcac7e3f5d835b35fe787126339dd2b Author: Patrick Palka <ppa...@redhat.com> Date: Tue Jun 25 10:42:21 2024 -0400 c++: using non-dep array var of unknown bound [PR115358] For a non-dependent array variable of unknown bound, it seems we need to try instantiating its definition upon use in a template context for sake of proper checking and typing of the overall expression, like we do for function specializations with deduced return type. PR c++/115358 gcc/cp/ChangeLog: * decl2.cc (mark_used): Call maybe_instantiate_decl for an array variable with unknown bound. * semantics.cc (finish_decltype_type): Remove now redundant handling of array variables with unknown bound. * typeck.cc (cxx_sizeof_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/template/array37.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com> (cherry picked from commit e3915c1ad56591cbd68229a64c941c38330abd69)