summaryrefslogtreecommitdiff
path: root/test/Sema/statementFunctions.f95
blob: 41692ca60654a8051dcbc0e561babdb15053bf52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
! RUN: %flang -fsyntax-only -verify < %s
! RUN: %flang -fsyntax-only -verify -ast-print %s 2>&1 | %file_check %s
PROGRAM test
  X(I) = I+2 ! CHECK: real((i+2))
  Y(A) = 1.0 ! CHECK: 1

  COMPLEX CC
  CC(M) = (0.0,1.0)

  CHARACTER*(10) ABC
  ABC(I) = 'ABC'

  COMPLEX ZP
  BAR(ZP) = AIMAG(ZP)

  INTEGER FOO ! expected-note@+1 {{previous definition is here}}
  FOO(I,I) = 1 ! expected-error {{redefinition of 'i'}}

  Z(A) = 'Hello' ! expected-error {{assigning to 'real' from incompatible type 'character'}}

  I = X(2) ! CHECK: i = int(x(2))
  I = X() ! expected-error {{too few arguments to function call, expected 1, have 0}}

  A = Y(2.0) ! CHECK: a = y(2)

  print *, ABC(1)

  CALL X(3) ! expected-error {{statement requires a subroutine reference (function 'x' invalid)}}

END PROGRAM test