1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! Test constant folding of type parameter values both a base value and a
4 ! parameter name are supplied.
6 ! Type parameters are described in 7.5.3 and constant expressions are described
7 ! in 10.1.12. 10.1.12, paragraph 4 defines whether a specification inquiry is
8 ! a constant expression. Section 10.1.11, paragraph 3, item (2) states that a
9 ! type parameter inquiry is a specification inquiry.
12 type dtype(goodDefaultKind
, badDefaultKind
)
13 integer, kind
:: goodDefaultKind
= 4
14 integer, kind
:: badDefaultKind
= 343
15 ! next field OK only if instantiated with a good value of goodDefaultKind
16 !ERROR: KIND parameter value (99) of intrinsic type REAL did not resolve to a supported value
17 real(goodDefaultKind
) :: goodDefaultField
18 ! next field OK only if instantiated with a good value of goodDefaultKind
19 !ERROR: KIND parameter value (343) of intrinsic type REAL did not resolve to a supported value
20 !ERROR: KIND parameter value (99) of intrinsic type REAL did not resolve to a supported value
21 real(badDefaultKind
) :: badDefaultField
24 type(dtype(4, 4)) :: v2
25 type(dtype(99, 4)) :: v3
26 type(dtype(4, 99)) :: v4
30 type baseType(baseParam
)
31 integer, kind
:: baseParam
= 4
33 type dtype(dtypeParam
)
34 integer, kind
:: dtypeParam
= 4
35 type(baseType(dtypeParam
)) :: baseField
36 !ERROR: KIND parameter value (343) of intrinsic type REAL did not resolve to a supported value
37 real(baseField
%baseParam
) :: realField
42 type(dtype(343)) :: v3
46 type dtype(goodDefaultLen
, badDefaultLen
)
47 integer, len
:: goodDefaultLen
= 4
48 integer, len
:: badDefaultLen
= 343
51 type(dtype(4, 4)) :: v2
52 type(dtype(99, 4)) :: v3
53 type(dtype(4, 99)) :: v4
54 real(v1
%goodDefaultLen
), pointer :: pGood1
55 !ERROR: REAL(KIND=343) is not a supported type
56 real(v1
%badDefaultLen
), pointer :: pBad1
57 real(v2
%goodDefaultLen
), pointer :: pGood2
58 real(v2
%badDefaultLen
), pointer :: pBad2
59 !ERROR: REAL(KIND=99) is not a supported type
60 real(v3
%goodDefaultLen
), pointer :: pGood3
61 real(v3
%badDefaultLen
), pointer :: pBad3
62 real(v4
%goodDefaultLen
), pointer :: pGood4
63 !ERROR: REAL(KIND=99) is not a supported type
64 real(v4
%badDefaultLen
), pointer :: pBad4