129 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! C7723module m14 type t15 contains6 procedure, nopass :: s17 !ERROR: Binding name 's2' not found in this derived type8 generic :: g1 => s29 end type10 type t211 integer :: s112 contains13 !ERROR: 's1' is not the name of a specific binding of this type14 generic :: g2 => s115 end type16contains17 subroutine s118 end19end20 21module m222 type :: t323 contains24 private25 procedure, nopass :: s326 generic, public :: g3 => s327 generic :: h3 => s328 end type29contains30 subroutine s3(i)31 end32end33 34! C77135module m336 use m237 type, extends(t3) :: t438 contains39 procedure, nopass :: s440 procedure, nopass :: s541 !ERROR: 'g3' does not have the same accessibility as its previous declaration42 generic, private :: g3 => s443 !ERROR: 'h3' does not have the same accessibility as its previous declaration44 generic, public :: h3 => s445 generic :: i3 => s446 !ERROR: 'i3' does not have the same accessibility as its previous declaration47 generic, private :: i3 => s548 end type49 type :: t550 contains51 private52 procedure, nopass :: s353 procedure, nopass :: s454 procedure, nopass :: s555 generic :: g5 => s3, s456 !ERROR: 'g5' does not have the same accessibility as its previous declaration57 generic, public :: g5 => s558 end type59contains60 subroutine s4(r)61 end62 subroutine s5(z)63 complex :: z64 end65end66 67! Test forward reference in type-bound generic to binding is allowed68module m469 type :: t170 contains71 generic :: g => s172 generic :: g => s273 procedure, nopass :: s174 procedure, nopass :: s275 end type76 type :: t277 contains78 generic :: g => p179 generic :: g => p280 procedure, nopass :: p1 => s181 procedure, nopass :: p2 => s282 end type83contains84 subroutine s1()85 end86 subroutine s2(x)87 end88end89 90! C773 - duplicate binding names91module m592 type :: t193 contains94 generic :: g => s195 generic :: g => s296 procedure, nopass :: s197 procedure, nopass :: s298 !ERROR: Binding name 's1' was already specified for generic 'g'99 generic :: g => s1100 end type101contains102 subroutine s1()103 end104 subroutine s2(x)105 end106end107 108module m6109 type t110 contains111 procedure :: f1112 procedure :: f2113 generic :: operator(.eq.) => f1114 !ERROR: Binding name 'f1' was already specified for generic 'operator(.eq.)'115 generic :: operator(==) => f2, f1116 end type117contains118 logical function f1(x, y) result(result)119 class(t), intent(in) :: x120 real, intent(in) :: y121 result = .true.122 end123 logical function f2(x, y) result(result)124 class(t), intent(in) :: x125 integer, intent(in) :: y126 result = .true.127 end128end129