[Bug fortran/44917] New: [OOP] Detect ambiguous specifics in a generic TBP interface
janus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jul 12 08:53:00 GMT 2010
The current form of the test case dynamic_dispatch_1.f03 is illegal:
module m
type :: t1
integer :: i = 42
procedure(make_real), pointer :: ptr
contains
procedure, pass :: real => make_real
procedure, pass :: make_integer
procedure, pass :: prod => i_m_j
generic, public :: extract => real, make_integer
generic, public :: base_extract => real, make_integer
end type t1
type, extends(t1) :: t2
integer :: j = 99
contains
procedure, pass :: real => make_real2
procedure, pass :: make_integer_2
procedure, pass :: prod => i_m_j_2
generic, public :: extract => real, make_integer_2
end type t2
contains
real function make_real (arg)
class(t1), intent(in) :: arg
make_real = real (arg%i)
end function make_real
real function make_real2 (arg)
class(t2), intent(in) :: arg
make_real2 = real (arg%j)
end function make_real2
integer function make_integer (arg, arg2)
class(t1), intent(in) :: arg
integer :: arg2
make_integer = arg%i * arg2
end function make_integer
integer function make_integer_2 (arg, arg2)
class(t2), intent(in) :: arg
integer :: arg2
make_integer_2 = arg%j * arg2
end function make_integer_2
integer function i_m_j (arg)
class(t1), intent(in) :: arg
i_m_j = arg%i
end function i_m_j
integer function i_m_j_2 (arg)
class(t2), intent(in) :: arg
i_m_j_2 = arg%j
end function i_m_j_2
end module m
It is rejected by the NAG compiler with:
Error: dynamic_dispatch_1.f03, line 58: Ambiguous specific type-bound
procedures MAKE_INTEGER_2 and MAKE_INTEGER for type-bound generic EXTRACT in
type T2
gfortran currently fails to detect that.
--
Summary: [OOP] Detect ambiguous specifics in a generic TBP
interface
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44917
More information about the Gcc-bugs
mailing list