[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / bind-c06.f90
blobc0a78a03c4742e9210837ab64b55e2ed34ce6a42
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for C1801 - C1805
4 module m
5 public s
6 contains
7 subroutine s
8 end
9 end
11 program main
12 use m
13 type, abstract :: v
14 integer :: i
15 end type
17 ! ERROR: A derived type with the BIND attribute cannot have the SEQUENCE attribute
18 type, bind(c) :: t1
19 sequence
20 integer :: x
21 end type
23 ! ERROR: A derived type with the BIND attribute has type parameter(s)
24 type, bind(c) :: t2(k)
25 integer, KIND :: k
26 integer :: x
27 end type
29 ! ERROR: A derived type with the BIND attribute cannot extend from another derived type
30 type, bind(c), extends(v) :: t3
31 integer :: x
32 end type
34 ! ERROR: A derived type with the BIND attribute cannot have a type bound procedure
35 type, bind(c) :: t4
36 integer :: x
37 contains
38 procedure, nopass :: b => s
39 end type
41 ! WARNING: A derived type with the BIND attribute is empty
42 type, bind(c) :: t5
43 end type
45 ! ERROR: A derived type with the BIND attribute cannot have a pointer or allocatable component
46 type, bind(c) :: t6
47 integer, pointer :: x
48 end type
50 ! ERROR: A derived type with the BIND attribute cannot have a pointer or allocatable component
51 type, bind(c) :: t7
52 integer, allocatable :: y
53 end type
55 ! ERROR: The component of the interoperable derived type must have the BIND attribute
56 type :: t8
57 integer :: x
58 end type
60 type, bind(c) :: t9
61 type(t8) :: y
62 integer :: z
63 end type
65 type, bind(c) :: t10
66 !ERROR: Each component of an interoperable derived type must have an interoperable type
67 character(len=2) x
68 end type
69 type, bind(c) :: t11
70 !ERROR: Each component of an interoperable derived type must have an interoperable type
71 character(kind=2) x
72 end type
73 type, bind(c) :: t12
74 !ERROR: Each component of an interoperable derived type must have an interoperable type
75 logical(kind=8) x
76 end type
77 type, bind(c) :: t13
78 !ERROR: Each component of an interoperable derived type must have an interoperable type
79 real(kind=2) x
80 end type
81 type, bind(c) :: t14
82 !ERROR: Each component of an interoperable derived type must have an interoperable type
83 complex(kind=2) x
84 end type
86 end