[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / bad-forward-type.f90
blob875ef95a6dbf9b1ee9c8b6ef8f585d1894322057
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Forward references to derived types (error cases)
4 ! C732 A parent-type-name shall be the name of a previously defined
5 ! extensible type (7.5.7).
7 !ERROR: The derived type 'undef' was forward-referenced but not defined
8 type(undef) function f1()
9 call sub(f1)
10 end function
12 !ERROR: The derived type 'undef' was forward-referenced but not defined
13 type(undef) function f2() result(r)
14 call sub(r)
15 end function
17 !ERROR: The derived type 'undefpdt' was forward-referenced but not defined
18 type(undefpdt(1)) function f3()
19 call sub(f3)
20 end function
22 !ERROR: The derived type 'undefpdt' was forward-referenced but not defined
23 type(undefpdt(1)) function f4() result(r)
24 call sub(f4)
25 end function
27 !ERROR: 'bad' is not the name of a parameter for derived type 'pdt'
28 type(pdt(bad=1)) function f5()
29 type :: pdt(good)
30 integer, kind :: good = kind(0)
31 integer(kind=good) :: n
32 end type
33 end function
35 subroutine s1(q1)
36 !ERROR: The derived type 'undef' was forward-referenced but not defined
37 implicit type(undef)(q)
38 end subroutine
40 subroutine s2(q1)
41 !ERROR: The derived type 'undefpdt' was forward-referenced but not defined
42 implicit type(undefpdt(1))(q)
43 end subroutine
45 subroutine s3
46 type :: t1
47 !ERROR: Derived type 'undef' not found
48 type(undef) :: x
49 end type
50 end subroutine
52 subroutine s4
53 type :: t1
54 !ERROR: Derived type 'undefpdt' not found
55 type(undefpdt(1)) :: x
56 end type
57 end subroutine
59 subroutine s5(x)
60 !ERROR: Derived type 'undef' not found
61 type(undef) :: x
62 end subroutine
64 subroutine s6(x)
65 !ERROR: Derived type 'undefpdt' not found
66 type(undefpdt(1)) :: x
67 end subroutine
69 subroutine s7(x)
70 !ERROR: Derived type 'undef' not found
71 type, extends(undef) :: t
72 end type
73 end subroutine
75 subroutine s8
76 implicit type(t2)(x)
77 !ERROR: Cannot construct value for derived type 't2' before it is defined
78 parameter(y=t2(12.3))
79 type t2
80 real :: c
81 end type
82 end subroutine
84 subroutine s9
85 type con
86 Type(t(3)), pointer :: y
87 end type
88 !ERROR: Cannot construct value for derived type 't' before it is defined
89 Integer :: nn = Size(Transfer(t(3)(666),[0]))
90 type :: t(n)
91 integer, kind :: n = 3
92 end type
93 end subroutine s9
95 subroutine s10
96 type t
97 !ERROR: The derived type 'undef' has not been defined
98 type(undef), pointer :: y
99 end type
100 end subroutine s10