https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089
--- Comment #29 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- This also fails: type :: t integer :: c end type t class(t), dimension(:), allocatable :: a, b class(t), dimension(:), allocatable :: c allocate (a(5), source=t(1)) allocate (b(5), source=t(7)) allocate(c(5), source=t(13)) c = plus(c(1), b) print *, c%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