Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / gfortran.dg / type_to_class_3.f03
blob7611155a2609cb163618cd0667851b6a02a5cf8d
1 ! { dg-do run }
3 ! Test the fix for the array version of PR64757.
5 ! Based on by Michael Lee Rilee  <mike@rilee.net>
7   type :: Test
8     integer :: i
9   end type
11   type :: TestReference
12      class(Test), allocatable :: test(:)
13   end type
15   type(TestReference) :: testList
16   type(test), allocatable :: x(:)
18   testList = TestReference([Test(99), Test(199)])  ! Gave: The rank of the element in the
19                                                    ! structure constructor at (1) does not
20                                                    ! match that of the component (1/0)
21 ! allocate (testList%test(2), source = [Test(99), Test(199)]) ! Works, of course
23   x = testList%test
25   select type (y => testList%test)    ! Check vptr set
26     type is (Test)
27       if (any(x%i .ne. y%i)) call abort
28     class default
29       call abort
30   end select
31 end