Debian Codegraph @

gcc/testsuite/gfortran.dg/implicit_class_1.f90

raw
1 ! { dg-do run }
2 ! { dg-skip-if "" { powerpc-ibm-aix* } }
3 !
4 ! PR 56500: [OOP] "IMPLICIT CLASS(...)" wrongly rejected
5 !
6 ! Contributed by Reinhold Bader <[email protected]>
7
8 ! Add dump-fortran-original to check, if the patch preventing a gfortran
9 ! segfault is working correctly. No cleanup needed, because the dump
10 ! goes to stdout.
11 ! { dg-options "-fdump-fortran-original" }
12 ! { dg-allow-blank-lines-in-output 1 }
13 ! { dg-prune-output "Namespace:.*-{42}" }
14
15 program upimp
16 implicit class(foo) (a-b)
17 implicit class(*) (c)
18 type :: foo
19 integer :: i
20 end type
21 allocatable :: aaf, caf
22
23 allocate(aaf, source=foo(2))
24 select type (aaf)
25 type is (foo)
26 if (aaf%i /= 2) STOP 1
27 class default
28 STOP 2
29 end select
30
31 allocate(caf, source=foo(3))
32 select type (caf)
33 type is (foo)
34 if (caf%i /= 3) STOP 3
35 class default
36 STOP 4
37 end select
38
39 contains
40 subroutine gloo(x)
41 implicit class(*) (a-z)
42 end
43 end program