https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089
--- Comment #26 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Works for type :: t integer :: c end type t type(t), dimension(5) :: a, b type(t), dimension(:), allocatable :: c a = t(1) b = t(7) allocate(c(5), source=t(13)) c = plus(c(1), b) print *, c if (any(c%c /= 20)) call abort contains elemental function plus(lhs, rhs) class(t), intent(in) :: lhs, rhs type(t) :: plus plus%c = lhs%c + rhs%c end function plus end so it seems class handling is going wrong somewhere...