https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118590
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think we need something like --- gcc/cp/typeck.cc.jj 2025-01-21 16:26:04.154690509 +0100 +++ gcc/cp/typeck.cc 2025-01-22 15:09:09.487161968 +0100 @@ -4867,6 +4867,11 @@ tree build_omp_array_section (location_t loc, tree array_expr, tree index, tree length) { + if (TREE_CODE (array_expr) == TYPE_DECL + || type_dependent_expression_p (array_expr)) + return build3_loc (loc, OMP_ARRAY_SECTION, NULL_TREE, array_expr, index, + length); + tree type = TREE_TYPE (array_expr); gcc_assert (type); type = non_reference (type); If array_expr is a type dependent expression, then all attempts to do something about its type are bogus. The type can be NULL or something the code doesn't really handle. But unfortunately type_dependent_expression_p will ICE if called on a TYPE_DECL which happens on pr67522.C. It will also ICE if array_expr is TYPE_P, but unsure if that can appear there. Sadly diagnostics for array sections is done much later...