public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid
@ 2014-06-16 16:06 mrestelli at gmail dot com
  2014-06-16 16:19 ` [Bug fortran/61527] " dominiq at lps dot ens.fr
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: mrestelli at gmail dot com @ 2014-06-16 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61527
           Summary: class/extends, multiple generic assignment, accept
                    invalid
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrestelli at gmail dot com

Hi,
   I see that gfortran accepts the following code (even with strict
debug flags) which is ambiguous in the resolution of the generic. The
code is correctly rejected if disp2 uses CLASS(t2) instead of
TYPE(t2), while with TYPE(T2) the code compiles and DISP2 is called,
which I think should not be allowed.


$ gfortran --version
GNU Fortran (GCC) 4.10.0 20140613 (experimental)



module m
 implicit none

 private
 public :: t1, t2, disp

 type :: t1
  integer :: i = 1
 end type t1

 type, extends(t1) :: t2
  real :: r = 2.0
 end type t2

 interface disp
  module procedure disp1, disp2
 end interface

contains

 subroutine disp1(x)
  class(t1), intent(in) :: x
   write(*,*) "Disp 1: ",x%i
 end subroutine disp1

 subroutine disp2(x)
  type(t2), intent(in) :: x ! <- accepted
  !class(t2), intent(in) :: x ! <- rejected
   write(*,*) "Disp 2: ",x%r
 end subroutine disp2

end module m


program p
 use m
 implicit none

 type(t1) :: a
 type(t2) :: b

 call disp(a)
 call disp(b)

end program p


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

end of thread, other threads:[~2024-04-26 10:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
2014-06-16 16:19 ` [Bug fortran/61527] " dominiq at lps dot ens.fr
2014-06-16 16:38 ` mrestelli at gmail dot com
2014-07-12 21:33 ` [Bug fortran/61527] [4.9/4.10 Regression] " burnus at gcc dot gnu.org
2014-07-12 22:05 ` dominiq at lps dot ens.fr
2014-10-30 10:40 ` [Bug fortran/61527] [4.9/5 " jakub at gcc dot gnu.org
2014-11-24 16:45 ` rguenth at gcc dot gnu.org
2015-01-16 17:16 ` janus at gcc dot gnu.org
2015-01-16 17:43 ` janus at gcc dot gnu.org
2015-06-26 20:01 ` [Bug fortran/61527] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:31 ` jakub at gcc dot gnu.org
2021-05-14  9:47 ` [Bug fortran/61527] [9/10/11/12 Regression] [OOP] " jakub at gcc dot gnu.org
2021-06-01  8:06 ` rguenth at gcc dot gnu.org
2022-05-27  9:35 ` [Bug fortran/61527] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug fortran/61527] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-26 10:06 ` pault at gcc dot gnu.org

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).