111
|
1 ! { dg-do compile }
|
|
2 ! Tests the fix for elemental functions not being allowed in
|
|
3 ! specification expressions in pure procedures.
|
|
4 !
|
|
5 ! Testcase from iso_varying_string by Rich Townsend <rhdt@star.ucl.ac.uk>
|
|
6 ! The allocatable component has been changed to a pointer for this testcase.
|
|
7 !
|
|
8 module iso_varying_string
|
|
9
|
|
10 type varying_string
|
|
11 private
|
|
12 character(LEN=1), dimension(:), pointer :: chars
|
|
13 end type varying_string
|
|
14
|
|
15 interface len
|
|
16 module procedure len_
|
|
17 end interface len
|
|
18
|
|
19 contains
|
|
20
|
|
21 pure function char_auto (string) result (char_string)
|
|
22 type(varying_string), intent(in) :: string
|
|
23 character(LEN=len(string)) :: char_string ! Error was here
|
|
24 char_string = ""
|
|
25 end function char_auto
|
|
26
|
|
27 elemental function len_ (string) result (length)
|
|
28 type(varying_string), intent(in) :: string
|
|
29 integer :: length
|
|
30 length = 1
|
|
31 end function len_
|
|
32
|
|
33 end module iso_varying_string
|