1! { dg-do compile }
2! { dg-shouldfail "Invalid use of IMPORT" }
3! Test invalid uses of import
4! PR fortran/29601
5
6subroutine test()
7  type myType3
8    import ! { dg-error "only permitted in an INTERFACE body" }
9    sequence
10    integer :: i
11  end type myType3
12end subroutine test
13
14program foo
15  import ! { dg-error "only permitted in an INTERFACE body" }
16  type myType
17    sequence
18    integer :: i
19  end type myType
20  type myType3
21    sequence
22    integer :: i
23  end type myType3
24  interface
25    import ! { dg-error "only permitted in an INTERFACE body" }
26    subroutine bar()
27      import foob ! { dg-error "Cannot IMPORT 'foob' from host scoping unit" }
28    end subroutine bar
29    subroutine test()
30      import :: ! { dg-error "Expecting list of named entities" }
31    end subroutine test
32  end interface
33end program foo
34