This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37712] New: Parent component name getting confused with structure constructor
- From: "w6ws at earthlink dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Oct 2008 06:25:17 -0000
- Subject: [Bug fortran/37712] New: Parent component name getting confused with structure constructor
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following test module creates two derived type, with the second extending
the first. Type-bound procedures for initialization are defined by both.
However when the init routine for the extended derived type attempts to call
the init routine in the parent type, via the parent component name, the
compiler gets confused. It thinks the parent component name is a structure
constructor and gives a fatal error:
module oo_mod
implicit none
type base_t
character(16) :: name
contains
procedure :: init=>base_init
end type
type x_t
integer :: value
contains
procedure :: init=>x_init
end type
contains
subroutine base_init (this, text)
type(base_t) :: this
character(*) :: text
this%name = text
end subroutine
subroutine x_init (this, text, value)
type(x_t) :: this
character(*) :: text
integer :: value
call base_t%init (text)
! or...
call base_init (base_t, text)
this%value = value
end subroutine
end module
wws@service0:/home/wws/fortran/oop> gfortran --version
GNU Fortran (GCC) 4.4.0 20081001 (experimental) [trunk revision 140806]
Copyright (C) 2008 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
wws@service0:/home/wws/fortran/oop> gfortran -c parent.f90
parent.f90:31.15:
call base_t%init (text)
1
Error: Syntax error in CALL statement at (1)
parent.f90:33.26:
call base_init (base_t, text)
1
Error: Syntax error in structure constructor at (1)
parent.f90:7.13:
procedure :: init=>base_init
1
Warning: Polymorphic entities are not yet implemented, non-polymorphic
passed-ob
ject dummy argument of 'base_init' at (1) accepted
parent.f90:13.13:
procedure :: init=>x_init
1
Warning: Polymorphic entities are not yet implemented, non-polymorphic
passed-ob
ject dummy argument of 'x_init' at (1) accepted
wws@service0:/home/wws/fortran/oop>
--
Summary: Parent component name getting confused with structure
constructor
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: w6ws at earthlink dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37712