File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -460,9 +460,6 @@ class CheckSpecificationExprHelper
460
460
: Base{*this }, scope_{s}, context_{context} {}
461
461
using Base::operator ();
462
462
463
- Result operator ()(const ProcedureDesignator &) const {
464
- return " dummy procedure argument" ;
465
- }
466
463
Result operator ()(const CoarrayRef &) const { return " coindexed reference" ; }
467
464
468
465
Result operator ()(const semantics::Symbol &symbol) const {
@@ -541,6 +538,20 @@ class CheckSpecificationExprHelper
541
538
" ' not allowed for derived type components or type parameter"
542
539
" values" ;
543
540
}
541
+ if (auto procChars{
542
+ characteristics::Procedure::Characterize (x.proc (), context_)}) {
543
+ const auto iter{std::find_if (procChars->dummyArguments .begin (),
544
+ procChars->dummyArguments .end (),
545
+ [](const characteristics::DummyArgument &dummy) {
546
+ return std::holds_alternative<characteristics::DummyProcedure>(
547
+ dummy.u );
548
+ })};
549
+ if (iter != procChars->dummyArguments .end ()) {
550
+ return " reference to function '" s + ultimate.name ().ToString () +
551
+ " ' with dummy procedure argument '" + iter->name + ' \' ' ;
552
+ }
553
+ }
554
+ // References to internal functions are caught in expression semantics.
544
555
// TODO: other checks for standard module procedures
545
556
} else {
546
557
const SpecificIntrinsic &intrin{DEREF (x.proc ().GetSpecificIntrinsic ())};
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ pure real function realfunc(x)
15
15
pure integer function hasProcArg(p)
16
16
import realfunc
17
17
procedure (realfunc) :: p
18
+ optional :: p
18
19
end function
19
20
end interface
20
21
integer :: coarray[* ]
@@ -37,8 +38,8 @@ subroutine test(out, optional)
37
38
integer , intent (in ), optional :: optional
38
39
! ERROR: Invalid specification expression: reference to OPTIONAL dummy argument 'optional'
39
40
type (t(optional )) :: x5
40
- ! ERROR: Invalid specification expression: dummy procedure argument
41
- type (t(hasProcArg(realfunc ))) :: x6
41
+ ! ERROR: Invalid specification expression: reference to function 'hasprocarg' with dummy procedure argument 'p'
42
+ type (t(hasProcArg())) :: x6
42
43
! ERROR: Invalid specification expression: coindexed reference
43
44
type (t(coarray[1 ])) :: x7
44
45
type (t(kind (foo()))) :: x101 ! ok
You can’t perform that action at this time.
0 commit comments