1 ! RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s
2 ! Test WhyNotDefinable() explanations
5 real, protected
:: prot
10 type(ptype
), protected
:: protptr
21 type(lock_type
) :: lock
30 type(list
), pointer :: prev
, next
32 character(*), parameter :: internal
= '0'
34 subroutine test1(dummy
)
36 integer, parameter :: j3
= 666
37 type(ptype
), intent(in
) :: dummy
40 !CHECK: error: Input variable 'a' is not definable
41 !CHECK: because: 'a' is construct associated with an expression
44 associate (a
=> arr([1])) ! vector subscript
45 !CHECK: error: Input variable 'a' is not definable
46 !CHECK: because: Construct association 'a' has a vector subscript
49 associate (a
=> arr(2:1:-1))
50 read(internal
,*) a
! ok
52 !CHECK: error: Input variable 'j3' is not definable
53 !CHECK: because: '666_4' is not a variable
55 !CHECK: error: Left-hand side of assignment is not definable
56 !CHECK: because: 't2var' is an entity with either an EVENT_TYPE or LOCK_TYPE
59 !CHECK: error: Left-hand side of assignment is not definable
60 !CHECK: because: 'prot' is protected in this scope
63 !CHECK: error: Left-hand side of assignment is not definable
64 !CHECK: because: 'dummy' is an INTENT(IN) dummy argument
68 pure
subroutine test2(ptr
)
69 integer, pointer, intent(in
) :: ptr
70 !CHECK: error: Input variable 'ptr' is not definable
71 !CHECK: because: 'ptr' is externally visible via 'ptr' and not definable in a pure subprogram
74 subroutine test3(objp
, procp
)
75 real, intent(in
), pointer :: objp
76 procedure(sin
), pointer, intent(in
) :: procp
77 !CHECK: error: Actual argument associated with INTENT(IN OUT) dummy argument 'op=' is not definable
78 !CHECK: because: 'objp' is an INTENT(IN) dummy argument
80 !CHECK: error: Actual argument associated with procedure pointer dummy argument 'pp=' may not be INTENT(IN)
84 real, intent(in out
), pointer :: op
87 procedure(sin
), pointer, intent(in out
) :: pp
90 type(ptype
), pointer, intent(in
) :: p
94 !CHECK: error: 'p' may not appear in NULLIFY
95 !CHECK: because: 'p' is an INTENT(IN) dummy argument
99 type(ptype
), intent(in
) :: np
100 !CHECK: error: 'ptr' may not appear in NULLIFY
101 !CHECK: because: 'np' is an INTENT(IN) dummy argument
104 pure
function test6(lp
)
105 type(list
), pointer :: lp
106 !CHECK: error: The left-hand side of a pointer assignment is not definable
107 !CHECK: because: 'lp' may not be defined in pure subprogram 'test6' because it is a POINTER dummy argument of a pure function
108 lp
%next
%next
=> null()
110 pure
subroutine test7(lp
)
111 type(list
), pointer :: lp
113 lp
%next
%next
=> null()