[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / assign08.f90
blob48f2976ed5a8ec22feb7cf801ed7ae639ad4d666
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! "Same type" checking for intrinsic assignment
3 module m1
4 type :: nonSeqType
5 integer :: n1
6 end type
7 type :: seqType
8 sequence
9 integer :: n2
10 end type
11 type, bind(c) :: bindCType
12 integer :: n3
13 end type
14 end module
16 program test
17 use m1, modNonSeqType => nonSeqType, modSeqType => seqType, modBindCType => bindCType
18 type :: nonSeqType
19 integer :: n1
20 end type
21 type :: seqType
22 sequence
23 integer :: n2
24 end type
25 type, bind(c) :: bindCType
26 integer :: n3
27 end type
28 type(modNonSeqType) :: mns1, mns2
29 type(modSeqType) :: ms1, ms2
30 type(modBindCType) :: mb1, mb2
31 type(nonSeqType) :: ns1, ns2
32 type(seqType) :: s1, s2
33 type(bindCType) :: b1, b2
34 ! These are trivially ok
35 mns1 = mns2
36 ms1 = ms2
37 mb1 = mb2
38 ns1 = ns2
39 s1 = s2
40 b1 = b2
41 ! These are ok per 7.5.2.4
42 ms1 = s1
43 mb1 = b1
44 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(modnonseqtype) and TYPE(nonseqtype)
45 mns1 = ns1
46 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(nonseqtype) and TYPE(modnonseqtype)
47 ns1 = mns1
48 end