[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / resolve20.f90
bloba3d240dbc598282fef832a25e2cd3bdfb734712c
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 module m
3 abstract interface
4 subroutine foo
5 end subroutine
6 subroutine foo2
7 end subroutine
8 end interface
10 procedure() :: a
11 procedure(integer) :: b
12 procedure(foo) :: c
13 procedure(bar) :: d
14 !ERROR: 'missing' must be an abstract interface or a procedure with an explicit interface
15 procedure(missing) :: e
16 !ERROR: 'b' must be an abstract interface or a procedure with an explicit interface
17 procedure(b) :: f
18 procedure(c) :: g
19 external :: h
20 !ERROR: 'h' must be an abstract interface or a procedure with an explicit interface
21 procedure(h) :: i
22 procedure(forward) :: j
23 !ERROR: 'bad1' must be an abstract interface or a procedure with an explicit interface
24 procedure(bad1) :: k1
25 !ERROR: 'bad2' must be an abstract interface or a procedure with an explicit interface
26 procedure(bad2) :: k2
27 !ERROR: 'bad3' must be an abstract interface or a procedure with an explicit interface
28 procedure(bad3) :: k3
30 abstract interface
31 subroutine forward
32 end subroutine
33 end interface
35 real :: bad1(1)
36 real :: bad2
37 type :: bad3
38 end type
40 !PORTABILITY: Name 'm' declared in a module should not have the same name as the module
41 type :: m
42 end type m
44 !ERROR: EXTERNAL attribute was already specified on 'a'
45 !ERROR: EXTERNAL attribute was already specified on 'b'
46 !ERROR: EXTERNAL attribute was already specified on 'c'
47 !ERROR: EXTERNAL attribute was already specified on 'd'
48 external :: a, b, c, d
49 !ERROR: EXTERNAL attribute not allowed on 'm'
50 external :: m
51 !WARNING: EXTERNAL attribute was already specified on 'foo'
52 external :: foo
53 !ERROR: EXTERNAL attribute not allowed on 'bar'
54 external :: bar
56 !ERROR: PARAMETER attribute not allowed on 'm'
57 parameter(m=2)
58 !ERROR: PARAMETER attribute not allowed on 'foo'
59 parameter(foo=2)
60 !ERROR: PARAMETER attribute not allowed on 'bar'
61 parameter(bar=2)
63 type, abstract :: t1
64 integer :: i
65 contains
66 !ERROR: 'proc' must be an abstract interface or a procedure with an explicit interface
67 !ERROR: Procedure component 'p1' must have NOPASS attribute or explicit interface
68 procedure(proc), deferred :: p1
69 end type t1
71 abstract interface
72 function f()
73 end function
74 end interface
76 contains
77 subroutine bar
78 end subroutine
79 subroutine test
80 !ERROR: Abstract procedure interface 'foo2' may not be referenced
81 call foo2()
82 !ERROR: Abstract procedure interface 'f' may not be referenced
83 x = f()
84 end subroutine
85 end module