public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47805] New: [OOP] Overridding hidden (private) TPB is rejected
@ 2011-02-18 17:06 burnus at gcc dot gnu.org
  2011-02-18 17:07 ` [Bug fortran/47805] " burnus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-18 17:06 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-13 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 17:06 [Bug fortran/47805] New: [OOP] Overridding hidden (private) TPB is rejected burnus at gcc dot gnu.org
2011-02-18 17:07 ` [Bug fortran/47805] " burnus at gcc dot gnu.org
2011-02-19 11:26 ` janus at gcc dot gnu.org
2011-02-19 14:23 ` janus at gcc dot gnu.org
2012-10-01 13:49 ` burnus at gcc dot gnu.org
2015-10-13 16:55 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).