c++: Check constant array bounds later.
authorJason Merrill <jason@redhat.com>
Thu, 21 May 2020 14:27:11 +0000 (10:27 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 21 May 2020 22:04:22 +0000 (18:04 -0400)
commitc37b1442fd2d3f9ee47bef69dcf154bd216f0f86
tree5a70c79c26f85756d6066699aeef0e61f0bc89a4
parentbeb019d346b903c16b9fd349937de444b6a8b6c0
c++: Check constant array bounds later.

We give a better diagnostic for non-constant array bounds in
compute_array_index_type_loc, we don't need to diagnose it in the parser.
But to avoid a regression on parse/varmod1.C we need to actually check
non-dependent expressions in a template.

gcc/cp/ChangeLog:

* decl.c (compute_array_index_type_loc): Diagnose expressions
in a template that can't be constant.
* parser.c (cp_parser_direct_declarator): Don't check
non-constant array bounds here.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/depend-iterator-2.c: Adjust.
* g++.dg/ext/vla1.C: Adjust.
* g++.dg/template/array9.C: Adjust.
* g++.dg/template/error41.C: Adjust.
gcc/cp/decl.c
gcc/cp/parser.c
gcc/testsuite/c-c++-common/gomp/depend-iterator-2.c
gcc/testsuite/g++.dg/ext/vla1.C
gcc/testsuite/g++.dg/template/array9.C
gcc/testsuite/g++.dg/template/error41.C