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 6651fa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 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
2 changes: 1 addition & 1 deletion src/sourcery/sourcery_test_description_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
module procedure equals
lhs_eq_rhs = (lhs%description_ == rhs%description_) .and. 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 6651fa5

Please sign in to comment.