Debian Codegraph @

gcc/testsuite/gfortran.dg/pdt_37.f03

raw
1 ! { dg-do compile }
2 !
3 ! Tests the fixes for PR82943.
4 !
5 ! This test focuses on the errors produced by incorrect LEN parameters for dummy
6 ! arguments of PDT Typebound Procedures.
7 !
8 ! Contributed by Alexander Westbrooks <[email protected]>
9 !
10 module test_len_param
11 implicit none
12 type :: param_deriv_type(a)
13 integer, len :: a
14 contains
15 procedure :: assumed_len_param ! Good. No error expected.
16 procedure :: assumed_len_param_ptr ! { dg-error "must not be POINTER" }
17 procedure :: assumed_len_param_alloc ! { dg-error "must not be ALLOCATABLE" }
18 procedure :: deferred_len_param ! { dg-error "must be ASSUMED" }
19 procedure :: deferred_len_param_ptr ! { dg-error "must be ASSUMED" }
20 procedure :: deferred_len_param_alloc ! { dg-error "must be ASSUMED" }
21 procedure :: fixed_len_param ! { dg-error "must be ASSUMED" }
22 procedure :: fixed_len_param_ptr ! { dg-error "must be ASSUMED" }
23 procedure :: fixed_len_param_alloc ! { dg-error "must be ASSUMED" }
24
25 end type
26
27 contains
28 subroutine assumed_len_param(this)
29 class(param_deriv_type(*)), intent(inout) :: this ! Good. No error expected.
30 ! TYPE(param_deriv_type(*)), intent(inout) :: that ! Good. No error expected.
31 end subroutine
32
33 subroutine assumed_len_param_ptr(this, that)
34 class(param_deriv_type(*)), intent(inout), pointer :: this ! Good. No error expected.
35 TYPE(param_deriv_type(*)), intent(inout), allocatable :: that ! Good. No error expected.
36 end subroutine
37
38 subroutine assumed_len_param_alloc(this, that)
39 class(param_deriv_type(*)), intent(inout), allocatable :: this ! Good. No error expected.
40 TYPE(param_deriv_type(*)), intent(inout), allocatable :: that ! Good. No error expected.
41 end subroutine
42
43 subroutine deferred_len_param(this, that) ! { dg-error "requires either the POINTER or ALLOCATABLE attribute" }
44 class(param_deriv_type(:)), intent(inout) :: this
45 TYPE(param_deriv_type(:)), intent(inout) :: that ! Good. No error expected.
46 end subroutine
47
48 subroutine deferred_len_param_ptr(this, that)
49 class(param_deriv_type(:)), intent(inout), pointer :: this ! Good. No error expected.
50 TYPE(param_deriv_type(:)), intent(inout), pointer :: that ! Good. No error expected.
51 end subroutine
52
53 subroutine deferred_len_param_alloc(this, that)
54 class(param_deriv_type(:)), intent(inout), allocatable :: this ! Good. No error expected.
55 TYPE(param_deriv_type(:)), intent(inout), allocatable :: that ! Good. No error expected.
56 end subroutine
57
58 subroutine fixed_len_param(this, that)
59 class(param_deriv_type(10)), intent(inout) :: this ! Good. No error expected.
60 TYPE(param_deriv_type(10)), intent(inout) :: that ! Good. No error expected.
61 end subroutine
62
63 subroutine fixed_len_param_ptr(this, that)
64 class(param_deriv_type(10)), intent(inout), pointer :: this ! Good. No error expected.
65 TYPE(param_deriv_type(10)), intent(inout), pointer :: that ! Good. No error expected.
66 end subroutine
67
68 subroutine fixed_len_param_alloc(this, that)
69 class(param_deriv_type(10)), intent(inout), allocatable :: this ! Good. No error expected.
70 TYPE(param_deriv_type(10)), intent(inout), allocatable :: that ! Good. No error expected.
71 end subroutine
72
73 end module
74