File: declarations05.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (42 lines) | stat: -rw-r--r-- 1,282 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
! RUN: %python %S/test_errors.py %s %flang_fc1
! Other checks for declarations in PURE procedures
module m
  type t0
  end type
  type t1
   contains
    final :: final
  end type
  type t2
    type(t1), allocatable :: c
  end type
  type t3
    class(t1), allocatable :: c
  end type
  type t4
    class(t0), allocatable :: c
  end type
 contains
  impure subroutine final(x)
    type(t1) x
  end
  pure subroutine test
    !ERROR: 'x0' may not be a local variable in a pure subprogram
    !BECAUSE: 'x0' is polymorphic in a pure subprogram
    class(t0), allocatable :: x0
    !ERROR: 'x1' may not be a local variable in a pure subprogram
    !BECAUSE: 'x1' has an impure FINAL procedure 'final'
    type(t1) x1
    !WARNING: 'x1a' of derived type 't1' does not have a FINAL subroutine for its rank (1)
    type(t1), allocatable :: x1a(:)
    !ERROR: 'x2' may not be a local variable in a pure subprogram
    !BECAUSE: 'x2' has an impure FINAL procedure 'final'
    type(t2) x2
    !ERROR: 'x3' may not be a local variable in a pure subprogram
    !BECAUSE: 'x3' has an impure FINAL procedure 'final'
    type(t3) x3
    !ERROR: 'x4' may not be a local variable in a pure subprogram
    !BECAUSE: 'x4' has polymorphic component '%c' in a pure subprogram
    type(t4) x4
  end
end