xref: /llvm-project/flang/test/Evaluate/expr01.f90 (revision f6ecea1a35758bbb504bc8d6f5dccf353ea1355b)
1! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
2! Ensures that parentheses are preserved with derived types
3module m
4  type :: t
5    integer :: n
6  end type
7 contains
8  subroutine sub(x)
9    type(t), intent(in) :: x
10  end subroutine
11  function f(m)
12    type(t), pointer :: f
13    integer, intent(in) :: m
14    type(t), save, target :: res
15    res%n = m
16    f => res
17  end function
18  subroutine test
19    type(t) :: x
20    x = t(1)
21    !CHECK: CALL sub(t(n=1_4))
22    call sub(t(1))
23    !CHECK: CALL sub((t(n=1_4)))
24    call sub((t(1)))
25    !CHECK: CALL sub(x)
26    call sub(x)
27    !CHECK: CALL sub((x))
28    call sub((x))
29    !CHECK: CALL sub(f(2_4))
30    call sub(f(2))
31    !CHECK: CALL sub((f(2_4)))
32    call sub((f(2)))
33  end subroutine
34end module
35