OSDN Git Service

fortran/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / specification_type_resolution_1.f90
1 ! { dg-do compile }
2 ! Test of the fix of PR27089, where gfortran was unable to resolve the
3 ! type of n_elements_uncommon_with_ in the specification expression on
4 ! line 21.
5 !
6 ! Test extracted from vec{int}.F90 of tonto.
7 !
8 module test
9    public    n_elements_uncommon_with_
10    interface n_elements_uncommon_with_
11       module procedure n_elements_uncommon_with
12    end interface
13 contains
14    pure function n_elements_uncommon_with(x) result(res)
15       integer(4), dimension(:), intent(in) :: x
16       integer(4) :: res
17       res = size (x, 1)
18    end function
19    pure function elements_uncommon_with(x) result(res)
20       integer(4), dimension(:), intent(in) :: x
21       integer(4), dimension(n_elements_uncommon_with_(x)) :: res
22       res = x
23    end function
24 end module test
25    use test
26    integer(4) :: z(4)
27    z = 1
28    print *, elements_uncommon_with (z)
29    print *, n_elements_uncommon_with_ (z)
30 end
31 ! { dg-final { cleanup-modules "test" } }