[flang-commits] [PATCH] D126151: [flang] Accept defined assignment with CLASS(*) RHS
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue May 24 13:46:04 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48a8a3eb2f56: [flang] Accept defined assignment with CLASS(*) RHS (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126151/new/
https://reviews.llvm.org/D126151
Files:
flang/lib/Semantics/tools.cpp
flang/test/Semantics/defined-ops.f90
Index: flang/test/Semantics/defined-ops.f90
===================================================================
--- flang/test/Semantics/defined-ops.f90
+++ flang/test/Semantics/defined-ops.f90
@@ -69,6 +69,10 @@
class(t), intent(out) :: x
integer, intent(in) :: y
end
+ subroutine s2(x, y)
+ real, intent(out) :: x
+ class(*), intent(in) :: y
+ end
end interface
interface operator(+)
integer function f(x, y)
@@ -77,12 +81,15 @@
end
end interface
contains
- subroutine test(x, y)
+ subroutine test(x, y, z)
class(t) :: x, y
+ class(*), intent(in) :: z
+ real :: a
!CHECK: CALL s1(x,2_4)
x = 2
!CHECK: i=f(x,y)
i = x + y
+ !CHECK: CALL s2(a,z)
+ a = z
end
end
-
Index: flang/lib/Semantics/tools.cpp
===================================================================
--- flang/lib/Semantics/tools.cpp
+++ flang/lib/Semantics/tools.cpp
@@ -103,9 +103,12 @@
if (!lhsType || !rhsType) {
return Tristate::No; // error or rhs is untyped
}
- if (lhsType->IsUnlimitedPolymorphic() || rhsType->IsUnlimitedPolymorphic()) {
+ if (lhsType->IsUnlimitedPolymorphic()) {
return Tristate::No;
}
+ if (rhsType->IsUnlimitedPolymorphic()) {
+ return Tristate::Maybe;
+ }
TypeCategory lhsCat{lhsType->category()};
TypeCategory rhsCat{rhsType->category()};
if (rhsRank > 0 && lhsRank != rhsRank) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126151.431782.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220524/4d00d4b2/attachment.bin>
More information about the flang-commits
mailing list