Index: flang/lib/Semantics/resolve-names.cpp =================================================================== --- flang/lib/Semantics/resolve-names.cpp +++ flang/lib/Semantics/resolve-names.cpp @@ -6933,7 +6933,15 @@ common::visit( common::visitors{ [&](const parser::Name &x) { HandleProcedureName(procFlag, x); }, - [&](const parser::ProcComponentRef &x) { Walk(x); }, + [&](const parser::ProcComponentRef &x) { + Walk(x); + const parser::Name &name{x.v.thing.component}; + if (Symbol * symbol{name.symbol}) { + if (IsProcedure(*symbol)) { + SetProcFlag(name, *symbol, procFlag); + } + } + }, }, std::get(call.t).u); Walk(std::get>(call.t)); Index: flang/test/Semantics/resolve09.f90 =================================================================== --- flang/test/Semantics/resolve09.f90 +++ flang/test/Semantics/resolve09.f90 @@ -113,3 +113,16 @@ function b8() b8 = 0.0 end + +subroutine s9 + type t + procedure(), nopass, pointer :: p1, p2 + end type + type(t) x + print *, x%p1() + call x%p2 + !ERROR: Cannot call function 'p1' like a subroutine + call x%p1 + !ERROR: Cannot call subroutine 'p2' like a function + print *, x%p2() +end subroutine