1! Program to test parsing of ENUM in different program units
2
3program main
4  implicit none
5  interface
6    subroutine sub1
7    end subroutine sub1
8  end interface
9  integer :: i = 55
10
11  enum , bind (c)
12    enumerator :: a , b=5
13    enumerator c, d
14  end enum
15
16  call sub
17  call sub1
18  i = fun()
19
20contains
21
22  subroutine sub
23    enum, bind(c)
24      enumerator :: p = b, q = 10 + 50
25      enumerator r, s
26    end enum
27  end subroutine sub
28
29  function fun()
30  integer :: fun
31  enum, bind (c)
32    enumerator :: red, yellow = 23
33    enumerator :: blue
34    enumerator :: green
35  end enum
36  fun = 1
37  end function fun
38end program main
39
40subroutine sub1
41  implicit none
42  enum, bind(c)
43    enumerator x , y
44    enumerator :: z = 100
45  end enum
46end subroutine sub1
47