PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / typebound_call_13.f03
blobdb220787e55f62c9100d91511f38cfe57aaa3342
1 ! { dg-do run }
3 ! PR 43256: [OOP] TBP with missing optional arg
5 ! Contributed by Janus Weil
7 module module_myobj
9   implicit none
11   type :: myobj
12   contains
13     procedure, nopass :: myfunc
14   end type
16 contains
18   integer function myfunc(status)
19     integer, optional :: status
20     if (present(status)) then
21       myfunc = 1
22     else
23       myfunc = 2
24     end if
25   end function
27 end module
30 program test_optional
32   use :: module_myobj
33   implicit none
35   integer     :: res = 0
36   type(myobj) :: myinstance
38   res = myinstance%myfunc()
39   if (res /= 2) call abort()
41 end program