blob: f408527d602fd355fe9e0534c12c81841ef95346 (
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
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
70
71
72
73
74
|
! { dg-do run }
!
! PR 45420: [OOP] polymorphic TBP call in a CLASS DEFAULT clause
!
! Contributed by Salvatore Filippone <salvatore.filippone@uniroma2.it>
module base_mat_mod
type :: base_sparse_mat
contains
procedure, pass(a) :: get_fmt => base_get_fmt
end type base_sparse_mat
contains
function base_get_fmt(a) result(res)
implicit none
class(base_sparse_mat), intent(in) :: a
character(len=5) :: res
res = 'NULL'
end function base_get_fmt
end module base_mat_mod
module d_base_mat_mod
use base_mat_mod
type, extends(base_sparse_mat) :: d_base_sparse_mat
contains
procedure, pass(a) :: get_fmt => d_base_get_fmt
end type d_base_sparse_mat
type, extends(d_base_sparse_mat) :: x_base_sparse_mat
contains
procedure, pass(a) :: get_fmt => x_base_get_fmt
end type x_base_sparse_mat
contains
function d_base_get_fmt(a) result(res)
implicit none
class(d_base_sparse_mat), intent(in) :: a
character(len=5) :: res
res = 'DBASE'
end function d_base_get_fmt
function x_base_get_fmt(a) result(res)
implicit none
class(x_base_sparse_mat), intent(in) :: a
character(len=5) :: res
res = 'XBASE'
end function x_base_get_fmt
end module d_base_mat_mod
program bug20
use d_base_mat_mod
class(d_base_sparse_mat), allocatable :: a
allocate(x_base_sparse_mat :: a)
if (a%get_fmt()/="XBASE") call abort()
select type(a)
type is (d_base_sparse_mat)
call abort()
class default
if (a%get_fmt()/="XBASE") call abort()
end select
end program bug20
|