https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86297

            Bug ID: 86297
           Summary: rejects valid code on type extension
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

The following code is rejected my gfortran 9.0 (I also checked 5.4.0). It is
accepted by nagfor 6.2 and ifort 18 and 19beta, but was rejected by ifort 17
with the same argument as by gfortran. It is rejected by PGI fortran v18.5.
Apparently, it is from an interp F08/0052 in F2008 corrigendum one and was
discussed by Ian Harvey on c.l.f. on July 5, 2016 under the topic
"Interpretation F08/0052 (overriding private bindings) ". Somehow, ifort
changed their minds to accept this code, so it is standard-compliant? 


MODULE example1_m1
  TYPE t1
   CONTAINS
     PROCEDURE,PRIVATE,NOPASS :: p ! (1).
  END TYPE t1
CONTAINS
  SUBROUTINE p
    PRINT *,'p'
  END SUBROUTINE p
  SUBROUTINE do_p(x)
    CLASS(t1) x
    CALL x%p
  END SUBROUTINE do_p
END MODULE example1_m1
MODULE example1_m2
  USE example1_m1
  TYPE,EXTENDS(t1) :: t2
   CONTAINS
     PROCEDURE,NOPASS :: p => p2 ! (2).
  END TYPE t2
CONTAINS
  SUBROUTINE p2(n)
    PRINT *,'p2',n
  END SUBROUTINE p2
END MODULE example1_m2
~

Reply via email to