mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:46:46 +00:00

A USE statement within a submodule (possibly in a nested scope) is not allowed to USE the submodule's ancestor module directly, but it is permissible to USE that ancestor module indirectly via another unrelated module. Don't emit "already present in scope" errors for this case. Fixes https://github.com/llvm/llvm-project/issues/124731.
25 lines
342 B
Fortran
25 lines
342 B
Fortran
!RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty
|
|
!CHECK-NOT: error:
|
|
module m1
|
|
interface
|
|
module subroutine foo
|
|
end
|
|
end interface
|
|
real x
|
|
end
|
|
module m2
|
|
use m1
|
|
end
|
|
submodule(m1) sm1
|
|
use m2 ! ok
|
|
contains
|
|
module procedure foo
|
|
end
|
|
end
|
|
submodule(m1) sm2
|
|
contains
|
|
subroutine bar
|
|
use m2 ! ok
|
|
end
|
|
end
|