xref: /llvm-project/flang/test/Semantics/complex01.f90 (revision 08c364280a790cb2a80fff86beb5ea69782ce667)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! C718 Each named constant in a complex literal constant shall be of type
3! integer or real.
4subroutine s()
5  integer :: ivar = 35
6  integer, parameter :: iconst = 35
7  real :: rvar = 68.9
8  real, parameter :: rconst = 68.9
9  character :: cvar = 'hello'
10  character, parameter :: cconst = 'hello'
11  logical :: lvar = .true.
12  logical, parameter :: lconst = .true.
13  complex :: cvar1 = (1, 1)
14  complex :: cvar2 = (1.0, 1.0)
15  complex :: cvar3 = (1.0, 1)
16  complex :: cvar4 = (1, 1.0)
17  complex :: cvar5 = (iconst, 1.0)
18  complex :: cvar6 = (iconst, rconst)
19  complex :: cvar7 = (rconst, iconst)
20
21  !ERROR: must be a constant
22  complex :: cvar8 = (ivar, 1.0)
23  !ERROR: must be a constant
24  !ERROR: must be a constant
25  complex :: cvar9 = (ivar, rvar)
26  !ERROR: must be a constant
27  !ERROR: must be a constant
28  complex :: cvar10 = (rvar, ivar)
29  !ERROR: operands must be INTEGER, UNSIGNED, REAL, or BOZ
30  complex :: cvar11 = (cconst, 1.0)
31  !ERROR: operands must be INTEGER, UNSIGNED, REAL, or BOZ
32  complex :: cvar12 = (lconst, 1.0)
33  !ERROR: operands cannot both be BOZ
34  complex :: cvar13 = (z'3f700000', z'00000000')
35end subroutine s
36