1! { dg-do compile }
2!
3! PR fortran/51754
4! This program was leading to an ICE related to class arrays
5!
6! Contributed by Andrew Benson <abenson@caltech.edu>
7
8module test
9  private
10
11  type :: componentB
12  end type componentB
13
14  type :: treeNode
15     class(componentB), allocatable, dimension(:) :: componentB
16  end type treeNode
17
18contains
19
20  function BGet(self)
21    implicit none
22    class(componentB), pointer :: BGet
23    class(treeNode), target, intent(in) :: self
24    select type (self)
25    class is (treeNode)
26       BGet => self%componentB(1)
27    end select
28    return
29  end function BGet
30
31end module test
32