1! { dg-do run } 2! 3! PR 43256: [OOP] TBP with missing optional arg 4! 5! Contributed by Janus Weil 6 7module module_myobj 8 9 implicit none 10 11 type :: myobj 12 contains 13 procedure, nopass :: myfunc 14 end type 15 16contains 17 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 26 27end module 28 29 30program test_optional 31 32 use :: module_myobj 33 implicit none 34 35 integer :: res = 0 36 type(myobj) :: myinstance 37 38 res = myinstance%myfunc() 39 if (res /= 2) STOP 1 40 41end program 42