module elem_assign
   implicit none
   type mytype
      integer x
   end type mytype
   interface assignment(=)
      module procedure myassign
   end interface assignment(=)
   contains
      elemental subroutine myassign(x,y)
         type(mytype), intent(out) :: x
         type(mytype), intent(in) :: y

         x%x = y%x
      end subroutine myassign
end module elem_assign

program test
   use elem_assign
   implicit none
   type(mytype) :: x(3) = (/mytype(7),mytype(11),mytype(13)/)
!   integer :: x(3) = (/7,11,13/)

   write(*,*) 'original x = ',x
   write(*,*) 'permuted x = ',x((/2,3,1/))
   x = x((/2,3,1/))
   write(*,*) '     new x = ',x
end program test
