Plugins: Add label-text.h to CPPLIB_H so it will be installed [PR115288]
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_type_7.f03
blob236c54df512078c065797e15da7a0d57e503258f
1 ! { dg-do run }
3 ! PR 41766: [OOP] SELECT TYPE selector as actual argument with INTENT(INOUT)
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7  implicit none
9  type t1
10    integer :: a
11  end type
13  type, extends(t1) :: t2
14    integer :: b
15  end type
17  class(t1),allocatable :: cp
19  allocate(t2 :: cp)
21  select type (cp)
22    type is (t2)
23      cp%a = 98
24      cp%b = 76
25      call s(cp)
26      print *,cp%a,cp%b
27      if (cp%a /= cp%b) STOP 1
28    class default
29      STOP 2
30  end select
32 contains
34   subroutine s(f)
35     type(t2), intent(inout) :: f
36     f%a = 3
37     f%b = 3
38   end subroutine
40 end