69 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! C815 An entity shall not be explicitly given any attribute more than once in 3! a scoping unit.4!5! R1512 procedure-declaration-stmt ->6! PROCEDURE ( [proc-interface] ) [[, proc-attr-spec]... ::]7! proc-decl-list8! proc-attr-spec values are:9! PUBLIC, PRIVATE, BIND(C), INTENT (intent-spec), OPTIONAL, POINTER, 10! PROTECTED, SAVE11module m12 abstract interface13 real function procFunc()14 end function procFunc15 end interface16 17 !WARNING: Attribute 'PUBLIC' cannot be used more than once [-Wredundant-attribute]18 procedure(procFunc), public, pointer, public :: proc119 !WARNING: Attribute 'PRIVATE' cannot be used more than once [-Wredundant-attribute]20 procedure(procFunc), private, pointer, private :: proc221 !WARNING: Attribute 'BIND(C)' cannot be used more than once [-Wredundant-attribute]22 !ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration23 procedure(procFunc), bind(c), pointer, bind(c) :: proc324 !WARNING: Attribute 'PROTECTED' cannot be used more than once [-Wredundant-attribute]25 procedure(procFunc), protected, pointer, protected :: proc426 !ERROR: A PROTECTED entity must be a variable or pointer27 external extsub28 protected extsub29 real x30 !ERROR: A PROTECTED entity must be a variable or pointer31 namelist /nml/ x32 protected nml33 !ERROR: A PROTECTED entity may not be in a common block34 real y35 common /blk/ y36 protected y37 logical,protected,external,pointer :: z38 39contains40 41 subroutine testProcDecl(arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)42 !WARNING: Attribute 'INTENT(IN)' cannot be used more than once [-Wredundant-attribute]43 procedure(procFunc), intent(in), pointer, intent(in) :: arg444 !WARNING: Attribute 'INTENT(OUT)' cannot be used more than once [-Wredundant-attribute]45 procedure(procFunc), intent(out), pointer, intent(out) :: arg546 !WARNING: Attribute 'INTENT(INOUT)' cannot be used more than once [-Wredundant-attribute]47 procedure(procFunc), intent(inout), pointer, intent(inout) :: arg648 !ERROR: Attributes 'INTENT(INOUT)' and 'INTENT(OUT)' conflict with each other49 procedure(procFunc), intent(inout), pointer, intent(out) :: arg750 !ERROR: Attributes 'INTENT(INOUT)' and 'INTENT(OUT)' conflict with each other51 procedure(procFunc), intent(out), pointer, intent(inout) :: arg852 !WARNING: Attribute 'OPTIONAL' cannot be used more than once [-Wredundant-attribute]53 procedure(procFunc), optional, pointer, optional :: arg954 !WARNING: Attribute 'POINTER' cannot be used more than once [-Wredundant-attribute]55 procedure(procFunc), pointer, optional, pointer :: arg1056 !WARNING: Attribute 'SAVE' cannot be used more than once [-Wredundant-attribute]57 procedure(procFunc), save, pointer, save :: localProc58 !ERROR: A PROTECTED entity must be in the specification part of a module59 real x60 protected x61 end subroutine testProcDecl62 63end module m64 65subroutine subb()66 !Ensure no spurious error from a benign UseError67 use m, testProcDecl=>z68end69