2 ! PR51870 - ALLOCATE with class function expression for SOURCE failed.
3 ! This version of the test allocates class arrays.
5 ! Reported by Tobias Burnus <burnus@gcc.gnu.org>
7 module show_producer_class
10 integer :: variable = 0
15 procedure ,nopass :: create_show
16 procedure ,nopass :: create_show_array
19 function create_show () result(new_integrand)
20 class(integrand) ,allocatable :: new_integrand
21 allocate(new_integrand)
22 new_integrand%variable = -1
24 function create_show_array (n) result(new_integrand)
25 class(integrand) ,allocatable :: new_integrand(:)
27 allocate(new_integrand(n))
28 select type (new_integrand)
29 type is (integrand); new_integrand%variable = [(i, i= 1, n)]
35 use show_producer_class
37 class(integrand) ,allocatable :: kernel(:)
38 type(show_producer) :: executive_producer
40 allocate(kernel(5),source=executive_producer%create_show_array (5))
42 type is (integrand); if (any (kernel%variable .ne. [1,2,3,4,5])) call abort
47 allocate(kernel(3),source=executive_producer%create_show ())
49 type is (integrand); if (any (kernel%variable .ne. -1)) call abort