aboutsummaryrefslogtreecommitdiff
path: root/flang/test/Semantics/array-constr-len.f90
blob: 9b23026a16012996b800ddecd6ddefb316b9f17a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
! RUN: %python %S/test_errors.py %s %flang_fc1
! Confirm enforcement of F'2023 7.8 p5
subroutine subr(s,n)
  character*(*) s
  !ERROR: Array constructor implied DO loop has no iterations and indeterminate character length
  print *, [(s(1:n),j=1,0)]
  !ERROR: Array constructor implied DO loop has no iterations and indeterminate character length
  print *, [(s(1:n),j=0,1,-1)]
  !ERROR: Array constructor implied DO loop has no iterations and indeterminate character length
  print *, [(s(1:j),j=1,0)]
  print *, [(s(1:1),j=1,0)] ! ok
  print *, [character(2)::(s(1:n),j=1,0)] ! ok
  print *, [character(n)::(s(1:n),j=1,0)]
  !ERROR: A length specifier of '*' or ':' may not appear in the type of an array constructor
  print *, [ character(:) :: ]
  !ERROR: A length specifier of '*' or ':' may not appear in the type of an array constructor
  print *, [ character(*) :: ]
end