1! { dg-do compile } 2! 3! Fix for PR53191 4! 5 implicit none 6 type t0 7 integer :: j = 42 8 end type t0 9 type, extends(t0) :: t1 10 integer :: k = 99 11 end type t1 12 type t 13 integer :: i 14 class(t0), allocatable :: foo 15 end type t 16 type(t) :: m(4) 17 integer :: n 18 19 do n = 1, 2 20 allocate(m(n)%foo, source = t0(n*99)) 21 end do 22 do n = 3, 4 23 allocate(m(n)%foo, source = t1(n*99, n*999)) 24 end do 25 26! An array of objects with ultimate class components cannot be a selector 27! since each element could have a different dynamic type. (F2003 C614) 28 29 select type(bar => m%foo) ! { dg-error "part reference with nonzero rank" } 30 type is(t0) 31 if (any (bar%j .ne. [99, 198, 297, 396])) call abort 32 type is(t1) 33 call abort 34 end select 35 36end 37