File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -5433,7 +5433,8 @@ void SubprogramVisitor::PushBlockDataScope(const parser::Name &name) {
54335433 }
54345434}
54355435
5436- // If name is a generic, return specific subprogram with the same name.
5436+ // If name is a generic in the same scope, return its specific subprogram with
5437+ // the same name, if any.
54375438Symbol *SubprogramVisitor::GetSpecificFromGeneric (const parser::Name &name) {
54385439 // Search for the name but don't resolve it
54395440 if (auto *symbol{currScope ().FindSymbol (name.source )}) {
@@ -5443,6 +5444,9 @@ Symbol *SubprogramVisitor::GetSpecificFromGeneric(const parser::Name &name) {
54435444 // symbol doesn't inherit it and ruin the ability to check it.
54445445 symbol->attrs ().reset (Attr::MODULE);
54455446 }
5447+ } else if (&symbol->owner () != &currScope () && inInterfaceBlock () &&
5448+ !isGeneric ()) {
5449+ // non-generic interface shadows outer definition
54465450 } else if (auto *details{symbol->detailsIf <GenericDetails>()}) {
54475451 // found generic, want specific procedure
54485452 auto *specific{details->specific ()};
Original file line number Diff line number Diff line change 1+ ! RUN: %flang -fc1 -fsyntax-only %s 2>&1 | FileCheck --allow-empty %s
2+ module foo_mod
3+ use , intrinsic :: iso_fortran_env
4+ use , intrinsic :: iso_c_binding
5+ implicit none
6+
7+ interface new_foo
8+ procedure :: foo_ctor
9+ end interface
10+
11+ contains
12+
13+ function foo_ctor (options ) result(retval)
14+ implicit none
15+ integer , intent (in ) :: options
16+ integer :: retval
17+
18+ interface
19+ ! CHECK-NOT: error:
20+ subroutine new_foo (f , opt ) bind(c, name= ' new_foo' )
21+ import
22+ implicit none
23+ integer , intent (inout ) :: f
24+ integer (c_int), intent (in ) :: opt
25+ end subroutine
26+ end interface
27+
28+ call new_foo(retval, options)
29+ end function
30+
31+ end module
You can’t perform that action at this time.
0 commit comments