[Bug fortran/51945] New: Diagnose wrong default initialization of DTs in a DT declaration

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 22 17:05:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51945

             Bug #: 51945
           Summary: Diagnose wrong default initialization of DTs in a DT
                    declaration
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program compiles without any error, until one uncomments the
type-declaration line. If one does, one gets the expected error.

Expected: One already gets an error without using the declared type.

The current error is most confusing if one has the type decalaration in a
module as one then gets:

use m
    1
Error: Can't convert TYPE(t3) to TYPE(t) at (1)


type t
integer :: i = 3
end type t

type, extends(t) ::  t2
end type t2

type ::  t3
integer :: i = 78
end type t3

type my_t
  type(t) :: x = t() ! OK
  type(t) :: y = t2() ! Invalid
  type(t) :: z = t3() ! Invalid
end type my_t

!type(my_t) :: a
end



More information about the Gcc-bugs mailing list