100 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12 3! C1568 The procedure-name shall have been declared to be a separate module4! procedure in the containing program unit or an ancestor of that program unit.5! C1547 MODULE shall appear only in the function-stmt or subroutine-stmt of a6! module subprogram or of a nonabstract interface body that is declared in the7! scoping unit of a module or submodule.8module m19 interface10 module subroutine sub1(arg1)11 integer, intent(inout) :: arg112 end subroutine13 module integer function fun1()14 end function15 end interface16 type t17 end type18 integer i19end module20 21submodule(m1) s122contains23 !ERROR: 'missing1' was not declared a separate module procedure24 module procedure missing125 end26 !ERROR: 'missing2' was not declared a separate module procedure27 module subroutine missing228 end29 !ERROR: 't' was not declared a separate module procedure30 module procedure t31 end32 !ERROR: 'i' was not declared a separate module procedure33 module subroutine i34 end35end submodule36 37module m238 interface39 module subroutine sub1(arg1)40 integer, intent(inout) :: arg141 end subroutine42 module integer function fun1()43 end function44 end interface45 type t46 end type47 !ERROR: Declaration of 'i' conflicts with its use as module procedure48 integer i49contains50 !ERROR: 'missing1' was not declared a separate module procedure51 module procedure missing152 end53 !ERROR: 'missing2' was not declared a separate module procedure54 module subroutine missing255 end56 !ERROR: 't' is already declared in this scoping unit57 !ERROR: 't' was not declared a separate module procedure58 module procedure t59 end60 !ERROR: 'i' was not declared a separate module procedure61 module subroutine i62 end63end module64 65! Separate module procedure defined in same module as declared66module m367 interface68 module subroutine sub69 end subroutine70 end interface71contains72 module procedure sub73 end procedure74end module75 76! Separate module procedure defined in a submodule77module m478 interface79 module subroutine a80 end subroutine81 module subroutine b82 end subroutine83 end interface84end module85submodule(m4) s4a86contains87 module procedure a88 end procedure89end submodule90submodule(m4:s4a) s4b91contains92 module procedure b93 end procedure94end95 96!ERROR: 'c1547' is a MODULE procedure which must be declared within a MODULE or SUBMODULE97real module function c1547()98 func = 0.099end function100