llvm-project/flang/test/Semantics/bindings04.f90
Peter Klausler a3c6a7d53d [flang] Stricter interface compatibility checking for TBP overrides
The compiler currently ignores attributes for PASS dummy arguments that
are incompatible between a type-bound procedure in an extended type and
the binding of the same name that it overrides in an ancestor type,
if any.  Strengthen this checking so that discrepancies between attributes
and intents are caught, and add some tests.

Differential Revision: https://reviews.llvm.org/D145110
2023-03-02 10:20:33 -08:00

58 lines
1.1 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
module m1
type t1
contains
procedure :: tbp => s1
end type
type, extends(t1) :: t1e
contains
!ERROR: A type-bound procedure and its override must have compatible interfaces
procedure :: tbp => s1e
end type
contains
subroutine s1(x)
class(t1) :: x
end
subroutine s1e(x)
class(t1e), intent(in out) :: x
end
end
module m2
type t1
contains
procedure :: tbp => s1
end type
type, extends(t1) :: t1e
contains
!ERROR: A type-bound procedure and its override must have compatible interfaces
procedure :: tbp => s1e
end type
contains
subroutine s1(x)
class(t1), intent(in out) :: x
end
subroutine s1e(x)
class(t1e) :: x
end
end
module m3
type t1
contains
procedure, nopass :: tbp => s1
end type
type, extends(t1) :: t1e
contains
!ERROR: A NOPASS type-bound procedure and its override must have identical interfaces
procedure, nopass :: tbp => s1e
end type
contains
subroutine s1(x)
real, intent(in out) :: x
end
subroutine s1e(x)
real :: x
end
end