aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/class_array_12.f03
blob: 9873db7b0bd5884db2d261f79c7ed01bdb0a3623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
! { dg-do compile }
!
! PR fortran/51754
! This program was leading to an ICE related to class arrays
!
! Contributed by Andrew Benson <abenson@caltech.edu>

module test
  private

  type :: componentB
  end type componentB

  type :: treeNode
     class(componentB), allocatable, dimension(:) :: componentB
  end type treeNode

contains

  function BGet(self)
    implicit none
    class(componentB), pointer :: BGet
    class(treeNode), target, intent(in) :: self
    select type (self)
    class is (treeNode)
       BGet => self%componentB(1)
    end select
    return
  end function BGet

end module test