This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Rejects valid code with type-bound assignment


Hi,

The following compiles successfully with gfortran 4.8.0 20120606 but fails 
with:

4531.F90:5.34:

     generic   :: assignment(=) => assign
                                  1
Error: Entity 'nca' at (1) is already present in the interface

when compiled with gfortran 4.8.0 20120819.

module gn
  type, public :: nc
   contains
     procedure :: assign => nca
     generic   :: assignment(=) => assign
  end type nc
  type, public, extends(nc) :: ncb
   contains
     procedure , nopass :: tis => bf
  end type ncb
contains
  subroutine nca(to,from)
    implicit none
    class(nc), intent(out) :: to
    type(nc), intent(in) :: from
  end subroutine nca
  logical function bf()
    implicit none
    bf=.false.
  end function bf
end module gn

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-
linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --
prefix=/home/abenson/Galacticus/Tools --enable-languages=c,c++,fortran --
disable-multilib --with-gmp=/home/abenson/Galacticus/Tools
Thread model: posix
gcc version 4.8.0 20120819 (experimental) (GCC) 
$ gfortran -c 4531.F90 -o 4531.o
4531.F90:5.34:

     generic   :: assignment(=) => assign
                                  1
Error: Entity 'nca' at (1) is already present in the interface

The test case was reduced from a much larger module using delta. The "ncb" 
type and the "tis => bf" binding seems to be necessary to trigger the problem. 

I can't find anything which appears to be related on bugzilla. I'll go ahead 
and file a PR unless someone can point out an existing one.

-Andrew.

-- 

* Andrew Benson: http://users.obs.carnegiescience.edu/abenson/contact.html

* Galacticus: http://sites.google.com/site/galacticusmodel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]