PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_type_24.f90
blobe47d00030f49972ec2356ff0595a57e556a395f9
1 ! { dg-do compile }
3 ! PR fortran/48887
5 ! "If the selector is allocatable, it shall be allocated; the
6 ! associate name is associated with the data object and does
7 ! not have the ALLOCATABLE attribute."
9 module m
10 type t
11 end type t
12 contains
13 subroutine one(a)
14 class(t), allocatable :: a
15 class(t), allocatable :: b
16 allocate (b)
17 select type (b)
18 type is(t)
19 call move_alloc (b, a) ! { dg-error "must be ALLOCATABLE" }
20 end select
21 end subroutine one
23 subroutine two (a)
24 class(t), allocatable :: a
25 type(t), allocatable :: b
26 allocate (b)
27 associate (c => b)
28 call move_alloc (b, c) ! { dg-error "must be ALLOCATABLE" }
29 end associate
30 end subroutine two
31 end module m
33 type t
34 end type t
35 class(t), allocatable :: x
37 select type(x)
38 type is(t)
39 print *, allocated (x) ! { dg-error "must be ALLOCATABLE" }
40 end select
42 select type(y=>x)
43 type is(t)
44 print *, allocated (y) ! { dg-error "must be ALLOCATABLE" }
45 end select
47 associate (y=>x)
48 print *, allocated (y) ! { dg-error "must be ALLOCATABLE" }
49 end associate
50 end