forked from OSchip/llvm-project
[flang] An erroneous type bound procedure was causing a call to CHECK()
I added a test to verify that the associated symbol did not have errors before doing the anaylsis of a call to a component ref along with a test that triggers the original problem. Differential Revision: https://reviews.llvm.org/D90074
This commit is contained in:
parent
b6204b995e
commit
b6b589ca84
|
@ -1700,6 +1700,9 @@ auto ExpressionAnalyzer::AnalyzeProcedureComponentRef(
|
||||||
const parser::StructureComponent &sc{pcr.v.thing};
|
const parser::StructureComponent &sc{pcr.v.thing};
|
||||||
if (MaybeExpr base{Analyze(sc.base)}) {
|
if (MaybeExpr base{Analyze(sc.base)}) {
|
||||||
if (const Symbol * sym{sc.component.symbol}) {
|
if (const Symbol * sym{sc.component.symbol}) {
|
||||||
|
if (context_.HasError(sym)) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
if (auto *dtExpr{UnwrapExpr<Expr<SomeDerived>>(*base)}) {
|
if (auto *dtExpr{UnwrapExpr<Expr<SomeDerived>>(*base)}) {
|
||||||
if (sym->has<semantics::GenericDetails>()) {
|
if (sym->has<semantics::GenericDetails>()) {
|
||||||
AdjustActuals adjustment{
|
AdjustActuals adjustment{
|
||||||
|
|
|
@ -114,3 +114,28 @@ module m
|
||||||
end subroutine s7
|
end subroutine s7
|
||||||
end module
|
end module
|
||||||
|
|
||||||
|
module m1
|
||||||
|
implicit none
|
||||||
|
interface g
|
||||||
|
module procedure mp
|
||||||
|
end interface g
|
||||||
|
|
||||||
|
type t
|
||||||
|
contains
|
||||||
|
!ERROR: The binding of 'tbp' ('g') must be either an accessible module procedure or an external procedure with an explicit interface
|
||||||
|
procedure,pass(x) :: tbp => g
|
||||||
|
end type t
|
||||||
|
|
||||||
|
contains
|
||||||
|
subroutine mp(x)
|
||||||
|
class(t),intent(in) :: x
|
||||||
|
end subroutine
|
||||||
|
end module m1
|
||||||
|
|
||||||
|
program test
|
||||||
|
use m1
|
||||||
|
type,extends(t) :: t2
|
||||||
|
end type
|
||||||
|
type(t2) a
|
||||||
|
call a%tbp
|
||||||
|
end program
|
||||||
|
|
Loading…
Reference in New Issue