mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 15:46:44 +00:00

Enforce an obscure constraint from the standard: an abstract interface is not allowed to have the same name as an intrinsic type keyword. I suspect this is meant to prevent a declaration like "PROCEDURE(REAL), POINTER :: P" from being ambiguous. Fixes https://github.com/llvm/llvm-project/issues/128744.
24 lines
849 B
Fortran
24 lines
849 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Test misuse of abstract interfaces
|
|
program test
|
|
abstract interface
|
|
subroutine abstract
|
|
end subroutine
|
|
!ERROR: An ABSTRACT interface may not have the same name as an intrinsic type
|
|
function integer()
|
|
end
|
|
!ERROR: An ABSTRACT interface may not have the same name as an intrinsic type
|
|
subroutine logical
|
|
end
|
|
end interface
|
|
procedure(abstract), pointer :: p
|
|
!ERROR: Abstract procedure interface 'abstract' may not be referenced
|
|
call abstract
|
|
!ERROR: Abstract procedure interface 'abstract' may not be used as a designator
|
|
p => abstract
|
|
!ERROR: Abstract procedure interface 'abstract' may not be used as a designator
|
|
call foo(abstract)
|
|
!ERROR: Abstract procedure interface 'abstract' may not be used as a designator
|
|
print *, associated(p, abstract)
|
|
end
|