xref: /llvm-project/flang/test/Semantics/assign13.f90 (revision 50960e93833c821598044db131cf820edf6c6b3f)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2program main
3  type t
4    character(4), pointer :: p
5  end type
6  character(5), target :: buff = "abcde"
7  type(t) x
8  !ERROR: Target type CHARACTER(KIND=1,LEN=5_8) is not compatible with pointer type CHARACTER(KIND=1,LEN=4_8)
9  x = t(buff)
10  !ERROR: Target type CHARACTER(KIND=1,LEN=3_8) is not compatible with pointer type CHARACTER(KIND=1,LEN=4_8)
11  x = t(buff(3:))
12  !ERROR: Target type CHARACTER(KIND=1,LEN=5_8) is not compatible with pointer type CHARACTER(KIND=1,LEN=4_8)
13  x%p => buff
14  !ERROR: Target type CHARACTER(KIND=1,LEN=3_8) is not compatible with pointer type CHARACTER(KIND=1,LEN=4_8)
15  x%p => buff(1:3)
16end
17