[flang-commits] [PATCH] D145102: [flang] Catch attempt to misuse an abstract procedure in a generic interface
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Mar 2 09:46:29 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5be7f8a666da: [flang] Catch attempt to misuse an abstract procedure in a generic interface (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145102/new/
https://reviews.llvm.org/D145102
Files:
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/generic02.f90
Index: flang/test/Semantics/generic02.f90
===================================================================
--- flang/test/Semantics/generic02.f90
+++ flang/test/Semantics/generic02.f90
@@ -1,10 +1,16 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
program test
+ !ERROR: Generic interface 'generic' must not use abstract interface 'abstract' as a specific procedure
interface generic
subroutine explicit(n)
integer, intent(in) :: n
end subroutine
procedure implicit
+ procedure abstract
+ end interface
+ abstract interface
+ subroutine abstract
+ end subroutine
end interface
!ERROR: Specific procedure 'implicit' of generic interface 'generic' must have an explicit interface
external implicit
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -1374,6 +1374,14 @@
GenericKind kind{details.kind()};
DistinguishabilityHelper helper{context_};
for (const Symbol &specific : details.specificProcs()) {
+ if (specific.attrs().test(Attr::ABSTRACT)) {
+ if (auto *msg{messages_.Say(generic.name(),
+ "Generic interface '%s' must not use abstract interface '%s' as a specific procedure"_err_en_US,
+ generic.name(), specific.name())}) {
+ msg->Attach(
+ specific.name(), "Definition of '%s'"_en_US, specific.name());
+ }
+ }
if (const Procedure *procedure{Characterize(specific)}) {
if (procedure->HasExplicitInterface()) {
helper.Add(generic, kind, specific, *procedure);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145102.501903.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230302/1ae8d1b9/attachment-0001.bin>
More information about the flang-commits
mailing list