44 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Other checks for declarations in PURE procedures3module m4 type t05 end type6 type t17 contains8 final :: final9 end type10 type t211 type(t1), allocatable :: c12 end type13 type t314 class(t1), allocatable :: c15 end type16 type t417 class(t0), allocatable :: c18 end type19 contains20 impure subroutine final(x)21 type(t1) x22 end23 pure subroutine test24 !ERROR: 'x0' may not be a local variable in a pure subprogram25 !BECAUSE: 'x0' is a whole polymorphic object in a pure subprogram26 class(t0), allocatable :: x027 !ERROR: 'x1' may not be a local variable in a pure subprogram28 !BECAUSE: 'x1' has an impure FINAL procedure 'final'29 type(t1) x130 !WARNING: 'x1a' of derived type 't1' does not have a FINAL subroutine for its rank (1) [-Wfinal]31 type(t1), allocatable :: x1a(:)32 type(t1), parameter :: namedConst = t1() ! ok33 !ERROR: 'x2' may not be a local variable in a pure subprogram34 !BECAUSE: 'x2' has an impure FINAL procedure 'final'35 type(t2) x236 !ERROR: 'x3' may not be a local variable in a pure subprogram37 !BECAUSE: 'x3' has an impure FINAL procedure 'final'38 type(t3) x339 !ERROR: 'x4' may not be a local variable in a pure subprogram40 !BECAUSE: 'x4' has polymorphic component '%c' in a pure subprogram41 type(t4) x442 end43end44