brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 5555f5e Raw
47 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Error tests for structure constructors.3! Errors caught by expression resolution are tested elsewhere; these are the4! errors meant to be caught by name resolution, as well as acceptable use5! cases.6! Type parameters are used to make the parses unambiguous.7 8module module19  type :: type1(j)10    integer, kind :: j11    integer :: n = 112  end type type113  type, extends(type1) :: type2(k)14    integer, kind :: k15    integer :: m16  end type type217  type :: privaten(j)18    integer, kind :: j19    integer, private :: n20  end type privaten21 contains22  subroutine type1arg(x)23    type(type1(0)), intent(in) :: x24  end subroutine type1arg25  subroutine type2arg(x)26    type(type2(0,0)), intent(in) :: x27  end subroutine type2arg28  subroutine errors29    call type1arg(type1(0)())30    call type1arg(type1(0)(1))31    call type1arg(type1(0)(n=1))32    !ERROR: Keyword 'bad=' does not name a component of derived type 'type1'33    call type1arg(type1(0)(bad=1))34    call type2arg(type2(0,0)(n=1,m=2))35    call type2arg(type2(0,0)(m=2))36    call type2arg(type2(0,0)(type1=type1(0)(n=1),m=2))37    call type2arg(type2(0,0)(type1=type1(0)(),m=2))38  end subroutine errors39end module module140 41module module242  !ERROR: No definition found for type parameter 'k'43  type :: type1(k)44  end type45  type(type1):: x46end module47