Files
clang-p2996/flang/test/Semantics/resolve117.f90
Peter Klausler 2216c4c6a4 [flang] Catch name conflict between generic TBP and inherited non-generic
A generic procedure binding in an extended derived type may not have the
same name as a symbol inherited from an ancestor type unless that inherited
symbol is also a generic TBP.  Since generic names can be things like
"ASSIGNMENT(=)", name resolution doesn't use OkToAddComponent() for
generic TBPs, which would have caught this error as it does for other
symbols in derived types, so it must be special-cased.

Differential Revision: https://reviews.llvm.org/D145109
2023-03-02 10:10:37 -08:00

28 lines
978 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Test name conflicts with type-bound generics
module m
type base1(k)
integer, kind :: k = 4
real x
contains
procedure, nopass :: tbp => sub
generic :: gen => tbp
end type
type, extends(base1) :: ext1
contains
procedure, nopass :: sub
!ERROR: Type parameter, component, or procedure binding 'base1' already defined in this type
generic :: base1 => sub
!ERROR: Type bound generic procedure 'k' may not have the same name as a non-generic symbol inherited from an ancestor type
generic :: k => sub
!ERROR: Type bound generic procedure 'x' may not have the same name as a non-generic symbol inherited from an ancestor type
generic :: x => sub
!ERROR: Type bound generic procedure 'tbp' may not have the same name as a non-generic symbol inherited from an ancestor type
generic :: tbp => sub
generic :: gen => sub ! ok
end type
contains
subroutine sub
end
end