[flang-commits] [flang] [flang] Reject interface name declared by a later PROCEDURE statement (PR #232928)
via flang-commits
flang-commits at lists.llvm.org
Tue Oct 20 21:55:15 PDT 2026
================
@@ -8816,6 +8817,23 @@ void DeclarationVisitor::CheckExplicitInterface(const parser::Name &name) {
}
}
+// C1515: a name that is declared by a procedure-declaration-stmt may be
+// used as an interface name only after that declaration.
+void DeclarationVisitor::CheckInterfaceNameDeclaredBeforeUse(
+ const parser::Name &name) {
+ if (const Symbol *symbol{name.symbol}) {
+ if (!context().HasError(*symbol) && symbol->has<ProcEntityDetails>() &&
+ symbol->HasExplicitInterface() &&
+ context().allCookedSources().Precedes(name.source, symbol->name())) {
----------------
Glitch-On wrote:
Thanks, fixed in 03dbcc6. The check now compares positions only when the use and the declaration are in the same cooked source, so a declaration read from a module file is never reported.
https://github.com/llvm/llvm-project/pull/232928
More information about the flang-commits
mailing list