[PATCH] D99085: [flang] Specific procedures named the same as the generic and a derived type

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 10:53:12 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5727df271498: [flang] Specific procedures named the same as the generic and a derived type (authored by PeteSteinfeld).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99085/new/

https://reviews.llvm.org/D99085

Files:
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Semantics/resolve18.f90


Index: flang/test/Semantics/resolve18.f90
===================================================================
--- flang/test/Semantics/resolve18.f90
+++ flang/test/Semantics/resolve18.f90
@@ -63,6 +63,15 @@
   function foo(x)
   end
 end
+module m4c
+  type :: foo
+  end type
+  interface foo
+    !ERROR: 'foo' is already declared in this scoping unit
+    real function foo()
+    end function foo
+  end interface foo
+end
 
 ! Use associating a name that is a generic and a derived type
 module m5a
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -3248,7 +3248,12 @@
       if (!specific) {
         specific =
             &currScope().MakeSymbol(name.source, Attrs{}, SubprogramDetails{});
-        details->set_specific(Resolve(name, *specific));
+        if (details->derivedType()) {
+          // A specific procedure with the same name as a derived type
+          SayAlreadyDeclared(name, *details->derivedType());
+        } else {
+          details->set_specific(Resolve(name, *specific));
+        }
       } else if (isGeneric()) {
         SayAlreadyDeclared(name, *specific);
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99085.332361.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210322/e7756782/attachment.bin>


More information about the llvm-commits mailing list