blob: 0800ba50526e4623656841eb5062dc39e059537d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
! { dg-do run }
!
! PR 43256: [OOP] TBP with missing optional arg
!
! Contributed by Janus Weil
module module_myobj
implicit none
type :: myobj
contains
procedure, nopass :: myfunc
end type
contains
integer function myfunc(status)
integer, optional :: status
if (present(status)) then
myfunc = 1
else
myfunc = 2
end if
end function
end module
program test_optional
use :: module_myobj
implicit none
integer :: res = 0
type(myobj) :: myinstance
res = myinstance%myfunc()
if (res /= 2) call abort()
end program
! { dg-final { cleanup-modules "module_myobj" } }
|