PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_type_31.f03
bloba2858121957be894507b96130c638a7568803bd5
1 ! { dg-do compile }
2 ! { dg-options "-fcoarray=single" }
3 ! Test the fix for PR55172.
5 ! Contributed by Arjen Markus  <arjen.markus@deltares.nl>
7 module gn
8   type :: ncb
9   end type ncb
10   type, public :: tn
11      class(ncb), allocatable, dimension(:) :: cb
12   end type tn
13 contains
14   integer function name(self)
15     implicit none
16     class (tn), intent(in) :: self
17     select type (component => self%cb(i)) ! { dg-error "has no IMPLICIT type" }
18     end select
19   end function name
20 end module gn
22 ! Further issues, raised by Tobias Burnus in the course of fixing the PR
24 module gn1
25   type :: ncb1
26   end type ncb1
27   type, public :: tn1
28      class(ncb1), allocatable, dimension(:) :: cb
29   end type tn1
30 contains
31   integer function name(self)
32     implicit none
33     class (tn1), intent(in) :: self
34     select type (component => self%cb([4,7+1])) ! { dg-error "needs a temporary" }
35     end select
36   end function name
37 end module gn1
39 module gn2
40   type :: ncb2
41   end type ncb2
42   type, public :: tn2
43      class(ncb2), allocatable :: cb[:]
44   end type tn2
45 contains
46   integer function name(self)
47     implicit none
48     class (tn2), intent(in) :: self
49     select type (component => self%cb[4]) ! { dg-error "must not be coindexed" }
50     end select
51   end function name
52 end module gn2