[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / resolve104.f90
blobd082981a40d2f3584aaae23c61ead36f70532aad
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test constant folding of type parameter values both a base value and a
3 ! parameter name are supplied.
4 !
5 ! Type parameters are described in 7.5.3 and constant expressions are described
6 ! in 10.1.12. 10.1.12, paragraph 4 defines whether a specification inquiry is
7 ! a constant expression. Section 10.1.11, paragraph 3, item (2) states that a
8 ! type parameter inquiry is a specification inquiry.
10 module m1
11 type dtype(goodDefaultKind, badDefaultKind)
12 integer, kind :: goodDefaultKind = 4
13 integer, kind :: badDefaultKind = 343
14 ! next field OK only if instantiated with a good value of goodDefaultKind
15 !ERROR: KIND parameter value (99) of intrinsic type REAL did not resolve to a supported value
16 real(goodDefaultKind) :: goodDefaultField
17 ! next field OK only if instantiated with a good value of goodDefaultKind
18 !ERROR: KIND parameter value (343) of intrinsic type REAL did not resolve to a supported value
19 !ERROR: KIND parameter value (99) of intrinsic type REAL did not resolve to a supported value
20 real(badDefaultKind) :: badDefaultField
21 end type dtype
22 type(dtype) :: v1
23 type(dtype(4, 4)) :: v2
24 type(dtype(99, 4)) :: v3
25 type(dtype(4, 99)) :: v4
26 end module m1
28 module m2
29 type baseType(baseParam)
30 integer, kind :: baseParam = 4
31 end type baseType
32 type dtype(dtypeParam)
33 integer, kind :: dtypeParam = 4
34 type(baseType(dtypeParam)) :: baseField
35 !ERROR: KIND parameter value (343) of intrinsic type REAL did not resolve to a supported value
36 real(dtypeParam) :: realField
37 end type dtype
39 type(dtype) :: v1
40 type(dtype(8)) :: v2
41 type(dtype(343)) :: v3
42 end module m2
44 module m3
45 type dtype(goodDefaultLen, badDefaultLen)
46 integer, len :: goodDefaultLen = 4
47 integer, len :: badDefaultLen = 343
48 end type dtype
49 type(dtype) :: v1
50 type(dtype(4, 4)) :: v2
51 type(dtype(99, 4)) :: v3
52 type(dtype(4, 99)) :: v4
53 real(v1%goodDefaultLen), pointer :: pGood1
54 !ERROR: REAL(KIND=343) is not a supported type
55 real(v1%badDefaultLen), pointer :: pBad1
56 real(v2%goodDefaultLen), pointer :: pGood2
57 real(v2%badDefaultLen), pointer :: pBad2
58 !ERROR: REAL(KIND=99) is not a supported type
59 real(v3%goodDefaultLen), pointer :: pGood3
60 real(v3%badDefaultLen), pointer :: pBad3
61 real(v4%goodDefaultLen), pointer :: pGood4
62 !ERROR: REAL(KIND=99) is not a supported type
63 real(v4%badDefaultLen), pointer :: pBad4
64 end module m3