1! { dg-do compile }
2! { dg-options "" }
3! [option to disable -pedantic as assumed character length
4!  functions are obsolescent]
5!
6! PR fortran/41235
7!
8
9character(len=*) function func()
10  func = 'ABC'
11end function func
12
13subroutine test(i)
14  integer :: i
15  character(len=i), external :: func
16  print *, func()
17end subroutine test
18
19subroutine test2(i)
20  integer :: i
21  character(len=i) :: func
22  print *, func()
23end subroutine test2
24
25call test(2)
26call test2(2)
27end
28