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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
! { dg-do compile }
! Tests the fix for PR33945, the host association of overloaded_type_s
! would be incorrectly blocked by the use associated overloaded_type.
!
! Contributed by Jonathan Hogg <J.Hogg@rl.ac.uk>
!
module dtype
implicit none
type overloaded_type
double precision :: part
end type
interface overloaded_sub
module procedure overloaded_sub_d
end interface
contains
subroutine overloaded_sub_d(otype)
type(overloaded_type), intent(in) :: otype
print *, "d type = ", otype%part
end subroutine
end module
module stype
implicit none
type overloaded_type
real :: part
end type
interface overloaded_sub
module procedure overloaded_sub_s
end interface
contains
subroutine overloaded_sub_s(otype)
type(overloaded_type), intent(in) :: otype
print *, "s type = ", otype%part
end subroutine
end module
program test
use stype, overloaded_type_s => overloaded_type
use dtype, overloaded_type_d => overloaded_type
implicit none
type(overloaded_type_s) :: sval
type(overloaded_type_d) :: dval
sval%part = 1
dval%part = 2
call fred(sval, dval)
contains
subroutine fred(sval, dval)
use stype
type(overloaded_type_s), intent(in) :: sval ! This caused an error
type(overloaded_type_d), intent(in) :: dval
call overloaded_sub(sval)
call overloaded_sub(dval)
end subroutine
end program
! { dg-final { cleanup-modules "stype dtype" } }
|