2017-11-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_65.f90
bloba82918c2087c129f5f46a8208f955bfecdb51a01
1 ! { dg-do run }
3 ! Test the fix for PR81447 in which a vtable was not being created
4 ! in the module 'm' so that x->vptr in 's' did not have the same
5 ! value as that in 'p'.
7 ! Contributed by Mat Cross <mathewc@nag.co.uk>
9 Module m
10 Type :: t
11 integer :: i
12 End Type
13 End Module
15 Program p
16 Use m
17 Class (t), Allocatable :: x
18 Interface
19 Subroutine s(x)
20 Use m
21 Class (t), Allocatable :: x
22 End Subroutine
23 End Interface
24 Call s(x)
25 Select Type (x)
26 Type Is (t)
27 Continue
28 Class Is (t)
29 call abort
30 Class Default
31 call abort
32 End Select
33 ! Print *, 'ok'
34 End Program
36 Subroutine s(x)
37 Use m, Only: t
38 Implicit None
39 Class (t), Allocatable :: x
40 Allocate (t :: x)
41 End Subroutine