]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: using non-dep array var of unknown bound [PR115358]
authorPatrick Palka <ppalka@redhat.com>
Tue, 25 Jun 2024 14:42:21 +0000 (10:42 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 25 Jun 2024 14:42:21 +0000 (10:42 -0400)
commite3915c1ad56591cbd68229a64c941c38330abd69
treec139567b6c66dbdd90aa38734f9c1a648af408ee
parent21f1073d388af8af207183b0ed592e1cc47d20ab
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 <jason@redhat.com>
gcc/cp/decl2.cc
gcc/cp/semantics.cc
gcc/cp/typeck.cc
gcc/testsuite/g++.dg/template/array37.C [new file with mode: 0644]