brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 27bf2a2 Raw
110 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12 3! case 1: ma_create_new_fun' was not declared a separate module procedure4module m15  integer :: i6  interface ma7    module function ma_create_fun( ) result(this)8      integer this9    end function10  end interface11end module12 13submodule (m1) ma_submodule14  integer :: j15  contains16  module function ma_create_fun() result(this)17    integer this18    i = 119    j = 220  end function21 22  !ERROR: 'ma_create_new_fun' was not declared a separate module procedure23  module function ma_create_new_fun() result(this)24    integer :: this25    i = 226    j = 127    print *, "Hello"28  end function29end submodule30 31! case 2: 'mb_create_new_sub' was not declared a separate module procedure32module m233  integer :: i34  interface mb35    module subroutine  mb_create_sub36    end subroutine mb_create_sub37  end interface38end module39 40submodule (m2) mb_submodule41  integer :: j42  contains43  module subroutine  mb_create_sub44    integer this45    i = 146    j = 247  end subroutine mb_create_sub48 49  !ERROR: 'mb_create_new_sub' was not declared a separate module procedure50  module SUBROUTINE  mb_create_new_sub() 51    integer :: this52    i = 253    j = 154  end SUBROUTINE mb_create_new_sub55end submodule56 57! case 3: separate module procedure without module prefix58module m359  interface mc60    function mc_create( ) result(this)61      integer :: this62    end function63  end interface64end module65 66submodule (m3) mc_submodule67  contains68  !ERROR: 'mc_create' was not declared a separate module procedure69  module function mc_create() result(this)70    integer :: this71  end function72end submodule73 74! case 4: Submodule having separate module procedure rather than a module75module m476  interface77    real module function func1()   ! module procedure interface body for func178    end function79  end interface80end module81 82submodule (m4) m4sub83  interface84    module function func2(b)       ! module procedure interface body for func285      integer :: b86      integer :: func287    end function88 89    real module function func3()   ! module procedure interface body for func390    end function91  end interface92  contains93    real module function func1()   ! implementation of func1 declared in m494      func1 = 2095    end function96end submodule97 98submodule (m4:m4sub) m4sub299  contains100    module function func2(b)       ! implementation of func2 declared in m4sub101      integer :: b102      integer :: func2103      func2 = b104    end function105 106    real module function func3()   ! implementation of func3 declared in m4sub107      func3 = 20108    end function109end submodule110