[Bug fortran/47805] New: [OOP] Overridding hidden (private) TPB is rejected
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 18 17:06:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47805
Summary: [OOP] Overridding hidden (private) TPB is rejected
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org
See http://j3-fortran.org/doc/year/11/11-141.txt and watch out for updates
(11-141r1.txt etc.), approved by J3 meeting.
Overriding a TBP seems to OK, if the TBP is hidden through accessibility
(PRIVATE).
Note (cf. example 2 in the IR): Abstract DT with private deferred TBP cannot be
extended as one cannot implement the deferred TBP.
The first example given in the file is rejected with:
PROCEDURE,NOPASS :: p => p2 ! (2).
1
Error: 'p' at (1) must have the same number of formal arguments as the
overridden procedure
MODULE example1_m1
TYPE t1
CONTAINS
PROCEDURE,PRIVATE,NOPASS :: p ! (1).
END TYPE
CONTAINS
SUBROUTINE p
PRINT *,'p'
END SUBROUTINE
SUBROUTINE do_p(x)
CLASS(t1) x
CALL x%p
END SUBROUTINE
END MODULE
MODULE example1_m2
USE example1_m1
TYPE,EXTENDS(t1) :: t2
CONTAINS
PROCEDURE,NOPASS :: p => p2 ! (2).
END TYPE
CONTAINS
SUBROUTINE p2(n)
PRINT *,'p2',n
END SUBROUTINE
END MODULE
PROGRAM example1
USE example1_m2
TYPE(t2),TARGET :: x
CLASS(t1),POINTER :: y
y => x
CALL do_p(x) ! (3): I expect this to print 'p'.
CALL do_p(y) ! (4): I expect this to print 'p'.
CALL x%p(13) ! (5): I expect this to print 'p2 13'.
END PROGRAM
More information about the Gcc-bugs
mailing list