You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module mo_vec
type :: typ1
real:: x
contains
procedure :: diff, neg
generic ::operator(-) => diff, neg
end type typ1
! extended type
type, extends(typ1) :: typ2
end type typ2
contains
pure type(typ1) function diff(this, that)
class(typ1), intent(in) :: this, that
diff = typ1(this%x-that%x)
end function diff
pure type(typ1) function neg(this)
class(typ1), intent(in) :: this
neg = typ1(-this%x)
end function neg
end module mo_vec
program vec_test
use mo_vec, only: typ2
type(typ2) :: var1 = typ2(1.), var2 = typ2(2.)
print*, -var2 ! error #5633: **Internal compiler error
print*, var1-var2 ! error #6355: This binary operation is invalid for this data type.
end program vec_test
Both the print statements fail for LFortran also.
The text was updated successfully, but these errors were encountered:
The bug, reported at https://fortran-lang.discourse.group/t/intel-fortran-compiler-bug-overloading-binary-and-unary-operator-and-use-with-extended-types/5836/10:
Both the print statements fail for LFortran also.
The text was updated successfully, but these errors were encountered: