2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / implicit_class_1.f90
blob380942cfdba559aa94c23ebcddd76196d657f288
1 ! { dg-do run }
2 ! { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } }
4 ! PR 56500: [OOP] "IMPLICIT CLASS(...)" wrongly rejected
6 ! Contributed by Reinhold Bader <Reinhold.Bader@lrz.de>
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}" }
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
23 allocate(aaf, source=foo(2))
24 select type (aaf)
25 type is (foo)
26 if (aaf%i /= 2) call abort
27 class default
28 call abort
29 end select
31 allocate(caf, source=foo(3))
32 select type (caf)
33 type is (foo)
34 if (caf%i /= 3) call abort
35 class default
36 call abort
37 end select
39 contains
40 subroutine gloo(x)
41 implicit class(*) (a-z)
42 end
43 end program