Fortran has an ambiguously defined rule about the typing of index variables of implied DO loops in DATA statements and array constructors that omit an explicit type specification. Such indices have the type that they would have "if they were variables" in the innermost enclosing scope. Although this could, and perhaps should, be read to mean that implicit typing rules active in that innermost enclosing scope should be applied, every other Fortran compiler interprets that language to mean that if there is a type declaration for that name that is visible from the enclosing scope, it is applied, and it is an error if that type is not integer. Fixes https://github.com/llvm/llvm-project/issues/91053.
9 lines
287 B
Fortran
9 lines
287 B
Fortran
!RUN: %python %S/test_errors.py %s %flang_fc1
|
|
subroutine s(i)
|
|
type(*) :: i
|
|
!ERROR: TYPE(*) dummy argument may only be used as an actual argument
|
|
!ERROR: Assumed-type entity 'i' must be a dummy argument
|
|
!ERROR: Must have INTEGER type, but is TYPE(*)
|
|
print *, [(i, i = 1,1)]
|
|
end
|