1!{ dg-do compile }
2! PR69268
3!
4! Contributed by Rich Townsend  <townsend@astro.wisc.edu>
5
6program test_sourced_alloc
7
8  implicit none
9
10  type :: foo_t
11  end type foo_t
12
13  class(foo_t), allocatable :: f
14
15  allocate(f, SOURCE=f_func())
16
17contains
18
19  function f_func () result (f)
20    type(foo_t) :: f
21    integer, save :: c = 0
22    c = c + 1
23    if (c .gt. 1) call abort()
24  end function f_func
25
26end program test_sourced_alloc
27