[flang] Detect call to abstract interface
A subroutine call or function reference to an abstract interface is not legal. Differential Revision: https://reviews.llvm.org/D93872
This commit is contained in:
parent
c0a2d3b90b
commit
f782d5ea86
|
@ -5879,7 +5879,10 @@ void ResolveNamesVisitor::HandleProcedureName(
|
|||
return; // reported error
|
||||
}
|
||||
CheckImplicitNoneExternal(name.source, *symbol);
|
||||
if (IsProcedure(*symbol) || symbol->has<DerivedTypeDetails>() ||
|
||||
if (symbol->has<SubprogramDetails>() &&
|
||||
symbol->attrs().test(Attr::ABSTRACT)) {
|
||||
Say(name, "Abstract interface '%s' may not be called"_err_en_US);
|
||||
} else if (IsProcedure(*symbol) || symbol->has<DerivedTypeDetails>() ||
|
||||
symbol->has<ObjectEntityDetails>() ||
|
||||
symbol->has<AssocEntityDetails>()) {
|
||||
// Symbols with DerivedTypeDetails, ObjectEntityDetails and
|
||||
|
|
|
@ -61,7 +61,18 @@ module m
|
|||
procedure(proc), deferred :: p1
|
||||
end type t1
|
||||
|
||||
abstract interface
|
||||
function f()
|
||||
end function
|
||||
end interface
|
||||
|
||||
contains
|
||||
subroutine bar
|
||||
end subroutine
|
||||
subroutine test
|
||||
!ERROR: Abstract interface 'foo' may not be called
|
||||
call foo()
|
||||
!ERROR: Abstract interface 'f' may not be called
|
||||
x = f()
|
||||
end subroutine
|
||||
end module
|
||||
|
|
Loading…
Reference in New Issue