1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! Test FINAL subroutine constraints C786-C789
8 procedure(valid
), pointer :: pointer
9 type :: parent(kind1
, len1
)
10 integer, kind
:: kind1
= 1
11 integer, len
:: len1
= 1
13 type, extends(parent
) :: child(kind2
, len2
)
14 integer, kind
:: kind2
= 2
15 integer, len
:: len2
= 2
18 !ERROR: FINAL subroutine 'external' of derived type 'child' must be a module procedure
19 !ERROR: FINAL subroutine 'sin' of derived type 'child' must be a module procedure
20 !ERROR: FINAL subroutine 'object' of derived type 'child' must be a module procedure
21 !ERROR: FINAL subroutine 'pointer' of derived type 'child' must be a module procedure
22 !ERROR: FINAL subroutine 'func' of derived type 'child' must be a subroutine
23 final
:: external, sin
, object
, pointer, func
24 !ERROR: FINAL subroutine 's01' of derived type 'child' must have a single dummy argument that is a data object
25 !ERROR: FINAL subroutine 's02' of derived type 'child' must have a single dummy argument that is a data object
26 !ERROR: FINAL subroutine 's03' of derived type 'child' must not have a dummy argument with INTENT(OUT)
27 !ERROR: FINAL subroutine 's04' of derived type 'child' must not have a dummy argument with the VALUE attribute
28 !ERROR: FINAL subroutine 's05' of derived type 'child' must not have a POINTER dummy argument
29 !ERROR: FINAL subroutine 's06' of derived type 'child' must not have an ALLOCATABLE dummy argument
30 !ERROR: FINAL subroutine 's07' of derived type 'child' must not have a coarray dummy argument
31 !ERROR: FINAL subroutine 's08' of derived type 'child' must not have a polymorphic dummy argument
32 !ERROR: FINAL subroutine 's09' of derived type 'child' must not have a polymorphic dummy argument
33 !ERROR: FINAL subroutine 's10' of derived type 'child' must not have an OPTIONAL dummy argument
34 final
:: s01
, s02
, s03
, s04
, s05
, s06
, s07
, s08
, s09
, s10
35 !ERROR: FINAL subroutine 's11' of derived type 'child' must have a single dummy argument
36 !ERROR: FINAL subroutine 's12' of derived type 'child' must have a single dummy argument
37 !ERROR: FINAL subroutine 's13' of derived type 'child' must have a dummy argument with an assumed LEN type parameter 'len1=*'
38 !ERROR: FINAL subroutine 's13' of derived type 'child' must have a dummy argument with an assumed LEN type parameter 'len2=*'
39 !ERROR: FINAL subroutine 's14' of derived type 'child' must have a dummy argument with an assumed LEN type parameter 'len2=*'
40 !ERROR: FINAL subroutine 's15' of derived type 'child' must have a dummy argument with an assumed LEN type parameter 'len1=*'
41 !ERROR: FINAL subroutine 's16' of derived type 'child' must not have a polymorphic dummy argument
42 !ERROR: FINAL subroutine 's17' of derived type 'child' must have a TYPE(child) dummy argument
43 final
:: s11
, s12
, s13
, s14
, s15
, s16
, s17
44 !ERROR: FINAL subroutine 'valid' already appeared in this derived type
46 !ERROR: FINAL subroutines 'valid2' and 'valid' of derived type 'child' cannot be distinguished by rank or KIND type parameter value
51 type(child(len1
=*, len2
=*)), intent(inout
) :: x
54 type(child(len1
=*, len2
=*)), intent(inout
) :: x
57 type(child(len1
=*, len2
=*)), intent(inout
) :: x
66 type(child(kind1
=3, len1
=*, len2
=*)), intent(out
) :: x
69 type(child(kind1
=4, len1
=*, len2
=*)), value
:: x
72 type(child(kind1
=5, len1
=*, len2
=*)), pointer :: x
75 type(child(kind1
=6, len1
=*, len2
=*)), allocatable
:: x
78 type(child(kind1
=7, len1
=*, len2
=*)) :: x
[*]
81 class(child(kind1
=8, len1
=*, len2
=*)) :: x
87 type(child(kind1
=10, len1
=*, len2
=*)), optional
:: x
90 type(child(kind1
=11, len1
=*, len2
=*)) :: x
, y
95 type(child(kind1
=13)) :: x
98 type(child(kind1
=14, len1
=*,len2
=2)) :: x
101 type(child(kind1
=15, len2
=*)) :: x
107 type(parent(kind1
=17, len1
=*)) :: x
112 !ERROR: FINAL subroutine 'internal' of derived type 't' must be a module procedure
116 subroutine internal(x
)
117 type(t
), intent(inout
) :: x