1! RUN: %python %S/test_errors.py %s %flang_fc1 2 3! C1568 The procedure-name shall have been declared to be a separate module 4! 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 a 6! module subprogram or of a nonabstract interface body that is declared in the 7! scoping unit of a module or submodule. 8module m1 9 interface 10 module subroutine sub1(arg1) 11 integer, intent(inout) :: arg1 12 end subroutine 13 module integer function fun1() 14 end function 15 end interface 16 type t 17 end type 18 integer i 19end module 20 21submodule(m1) s1 22contains 23 !ERROR: 'missing1' was not declared a separate module procedure 24 module procedure missing1 25 end 26 !ERROR: 'missing2' was not declared a separate module procedure 27 module subroutine missing2 28 end 29 !ERROR: 't' was not declared a separate module procedure 30 module procedure t 31 end 32 !ERROR: 'i' was not declared a separate module procedure 33 module subroutine i 34 end 35end submodule 36 37module m2 38 interface 39 module subroutine sub1(arg1) 40 integer, intent(inout) :: arg1 41 end subroutine 42 module integer function fun1() 43 end function 44 end interface 45 type t 46 end type 47 !ERROR: Declaration of 'i' conflicts with its use as module procedure 48 integer i 49contains 50 !ERROR: 'missing1' was not declared a separate module procedure 51 module procedure missing1 52 end 53 !ERROR: 'missing2' was not declared a separate module procedure 54 module subroutine missing2 55 end 56 !ERROR: 't' is already declared in this scoping unit 57 !ERROR: 't' was not declared a separate module procedure 58 module procedure t 59 end 60 !ERROR: 'i' was not declared a separate module procedure 61 module subroutine i 62 end 63end module 64 65! Separate module procedure defined in same module as declared 66module m3 67 interface 68 module subroutine sub 69 end subroutine 70 end interface 71contains 72 module procedure sub 73 end procedure 74end module 75 76! Separate module procedure defined in a submodule 77module m4 78 interface 79 module subroutine a 80 end subroutine 81 module subroutine b 82 end subroutine 83 end interface 84end module 85submodule(m4) s4a 86contains 87 module procedure a 88 end procedure 89end submodule 90submodule(m4:s4a) s4b 91contains 92 module procedure b 93 end procedure 94end 95 96!ERROR: 'c1547' is a MODULE procedure which must be declared within a MODULE or SUBMODULE 97real module function c1547() 98 func = 0.0 99end function 100