dependent type or whose size is specified by a constant expression
that is value-dependent. */
/* We can only call value_dependent_expression_p on integral constant
- expressions; treat non-constant expressions as dependent, too. */
+ expressions. */
if (processing_template_decl
- && (!TREE_CONSTANT (size) || value_dependent_expression_p (size)))
+ && potential_constant_expression (size)
+ && value_dependent_expression_p (size))
{
- /* We cannot do any checking for a SIZE that isn't known to be
- constant. Just build the index type and mark that it requires
+ /* Just build the index type and mark that it requires
structural equality checks. */
+ in_template:
itype = build_index_type (build_min (MINUS_EXPR, sizetype,
size, size_one_node));
TYPE_DEPENDENT_P (itype) = 1;
}
if (processing_template_decl && !TREE_CONSTANT (size))
- /* A variable sized array. */
- itype = build_min (MINUS_EXPR, sizetype, size, integer_one_node);
+ goto in_template;
else
{
if (!TREE_CONSTANT (size))
/* OK */;
else if (error_operand_p (bounds))
/* Already gave an error. */;
+ else if (!cp_parser_uncommitted_to_tentative_parse_p (parser))
+ /* Let compute_array_index_type diagnose this. */;
else if (!parser->in_function_body
|| current_binding_level->kind == sk_function_parms)
{
;
#pragma omp task depend (iterator (int i = 0:4, \
struct U { int (*p)[i + 2]; } *p = 0:2) , in : a) /* { dg-error "type of iterator 'p' refers to outer iterator 'i'" "" { target c } } */
- ; /* { dg-error "types may not be defined in iterator type|not an integer constant" "" { target c++ } .-1 } */
+ ; /* { dg-error "types may not be defined in iterator type|not an integral constant" "" { target c++ } .-1 } */
#pragma omp task depend (iterator (i = 0:4, j = i:16) , in : a) /* { dg-error "begin expression refers to outer iterator 'i'" } */
;
#pragma omp task depend (iterator (i = 0:4, j = 2:i:1) , in : a) /* { dg-error "end expression refers to outer iterator 'i'" } */
B::B (int i)
{
struct S {
- int ar[1][i]; // { dg-error "15:size of array .ar. is not an integral" "" { target c++11 } }
-// { dg-error "array bound" "" { target c++98_only } .-1 }
+ int ar[1][i]; // { dg-error "15:size of array .ar. is not an integral" }
} s;
s.ar[0][0] = 0; // { dg-prune-output "no member" }