[Bug fortran/56939] New: [4.8/4.9 Regression] [OOP] Derived type is being used before it is defined
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 12 19:08:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56939
Bug #: 56939
Summary: [4.8/4.9 Regression] [OOP] Derived type is being used
before it is defined
Classification: Unclassified
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: janus@gcc.gnu.org
The following is a reduction of PR 55959 comment 0, which is valid code AFAICS:
module pdfs
type, abstract :: pdf
integer dims
contains
procedure(getx), deferred :: getx
end type
abstract interface
function getx(this)
import pdf
class(pdf), intent(in) :: this
real getx(this%dims)
end function
end interface
type point
real x, y
end type
type, extends(pdf) :: pdf_point
type(point) p
contains
procedure :: getx => pdf_point_getx
end type
contains
function pdf_point_getx(this)
class(pdf_point), intent(in) :: this
real pdf_point_getx(this%dims)
end function
end module pdfs
program abstract
use pdfs
end program
With 4.8 and trunk it gives the nonsensical error message:
use pdfs
1
Error: Derived type 'pdf' at (1) is being used before it is defined
(while 4.7 accepts it without a problem.)
More information about the Gcc-bugs
mailing list