Skip to content

Commit

Permalink
fix: work around ifx impure function-ref bug
Browse files Browse the repository at this point in the history
According to the Fortran 2023 interpretation document requirement
R1520 and R1521, a function-reference contains non-optional
parentheses, which makes it standard-conforming to reference the
user-defined generic operator(==) that is bound to the derived
type test_description_t.  For now, however, we make the operator
impure to work around a compiler bug.
  • Loading branch information
Damian Rouson committed May 2, 2024
1 parent a3d9df3 commit 73a7b53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ impure elemental module function contains_text(self, substring) result(match)
logical match
end function

#ifdef __INTEL_COMPILER
impure &
#endif
elemental module function equals(lhs, rhs) result(lhs_eq_rhs)
!! The result is .true. if the components of the lhs & rhs are equal
implicit none
Expand All @@ -73,4 +76,4 @@ elemental module function equals(lhs, rhs) result(lhs_eq_rhs)

end interface

end module sourcery_test_description_m
end module sourcery_test_description_m
5 changes: 3 additions & 2 deletions src/sourcery/sourcery_test_description_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
end procedure

module procedure equals
lhs_eq_rhs = (lhs%description_ == rhs%description_) .and. associated(lhs%test_function_, rhs%test_function_)
!lhs_eq_rhs = (lhs%description_ == rhs%description_) .and. associated(lhs%test_function_, rhs%test_function_)
lhs_eq_rhs = associated(lhs%test_function_, rhs%test_function_)
end procedure
end submodule sourcery_test_description_s
end submodule sourcery_test_description_s

0 comments on commit 73a7b53

Please sign in to comment.