https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:f7ff1d5923f2c42ac15780b452dd1bc72d94db64 commit r13-9708-gf7ff1d5923f2c42ac15780b452dd1bc72d94db64 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)