summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dummy_optional_arg.f90
blob: 4c0417bffc0914f89ef93cc6f9ad89cc290ee7ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
! { dg-do compile }
! PR fortran/45495
!
! Code originally submitted by Philip Mason <pmason at ricardo dot com>
!
function jack(aa)
   character(len=*), intent(in) :: aa
   optional :: aa
   character(len=len(aa)+1) :: jack ! { dg-error "cannot be OPTIONAL" }
   jack = ''
end function jack

function diane(aa)
   character(len=*), intent(out) :: aa
   character(len=len(aa)+1) :: diane
   diane = '012345678901'
   aa = 'abcdefghijklmn'
end function diane