1! { dg-do compile }
2!
3! PR fortran/51383
4!
5! Contributed by kaiserkarl31@yahoo.com
6!
7! Was failing before at the ref resolution of y1(1)%i.
8!
9program extend
10   type :: a
11      integer :: i
12   end type a
13   type, extends (a) :: b
14      integer :: j
15   end type b
16   type (a) :: x(2)
17   type (b) :: y(2)
18   associate (x1 => x, y1 => y)
19      x1(1)%i = 1
20      ! Commenting out the following line will avoid the error
21      y1(1)%i = 2
22   end associate
23end program extend
24