1! { dg-do compile }
2!
3! PR fortran/47399
4!
5! Contributed by Wolfgang Kilian.
6!
7
8module mytypes
9   implicit none
10   private
11   public :: mytype, get_i
12
13   integer, save :: i_priv = 13
14   type :: mytype
15      integer :: dummy
16    contains
17      procedure, nopass :: i => get_i
18   end type mytype
19 contains
20   pure function get_i () result (i)
21     integer :: i
22     i = i_priv
23   end function get_i
24end module mytypes
25
26subroutine test()
27   use mytypes
28   implicit none
29
30   type(mytype) :: a
31   type(mytype), parameter :: a_const = mytype (0)
32   integer, dimension (get_i()) :: x            ! #1
33   integer, dimension (a%i()) :: y              ! #2
34   integer, dimension (a_const%i()) :: z        ! #3
35
36   if (size (x) /= 13 .or. size(y) /= 13 .or. size(z) /= 13) call abort()
37!   print *, size (x), size(y), size(z)
38end subroutine test
39
40call test()
41end
42