Fortran · 740 bytes Raw Blame History
1 ! Three-specific generic with mixed integer kinds: dispatch must
2 ! distinguish integer(4) and integer(8) actuals. Audit-level: the
3 ! kind-aware dispatch added in this sprint must not collapse
4 ! integer kinds the way it used to collapse real and double.
5 ! CHECK: 4
6 ! CHECK: 8
7 ! CHECK: 16
8 module three_int
9 implicit none
10 interface tag
11 module procedure tag_i4, tag_i8
12 end interface
13 contains
14 integer function tag_i4(x)
15 integer(4), intent(in) :: x
16 tag_i4 = 4
17 end function
18 integer function tag_i8(x)
19 integer(8), intent(in) :: x
20 tag_i8 = 8
21 end function
22 end module
23 program t
24 use three_int
25 implicit none
26 integer(4) :: a = 1
27 integer(8) :: b = 2_8
28 print *, tag(a)
29 print *, tag(b)
30 print *, 16
31 end program
32