From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9965 invoked by alias); 21 May 2010 14:02:09 -0000 Received: (qmail 4804 invoked by uid 48); 21 May 2010 14:01:43 -0000 Date: Fri, 21 May 2010 14:02:00 -0000 Message-ID: <20100521140143.4803.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/42385] [OOP] poylmorphic operators do not work In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "damian at rouson dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg02335.txt.bz2 ------- Comment #1 from damian at rouson dot net 2010-05-21 14:01 ------- As suggested by Janus and Paul, I'm adding the additional test case below. Note that the first two pointer assignments in main are not necessary to demonstrate the linking problem. I put them there (1) to give more detail about what I was trying to do and (2) because deleting those leaves pointless code since there would be no reason to do the the third assignment without doing the first two. $cat link_demo.f03 module field_module implicit none type ,abstract :: field contains procedure(field_eq_field) ,deferred :: assign generic :: assignment(=) => assign end type abstract interface subroutine field_eq_field(lhs,rhs) import :: field class(field) ,intent(out) :: lhs class(field) ,intent(in) :: rhs end subroutine end interface end module module periodic_field_module use field_module ,only : field implicit none type ,extends(field) :: periodic_field real :: f=0. contains procedure :: assign => copy end type contains function new_periodic_field() type(periodic_field) ,pointer :: new_periodic_field allocate(new_periodic_field) end function subroutine copy(lhs,rhs) class(field) ,intent(in) :: rhs class(periodic_field) ,intent(out) :: lhs select type(rhs) class is (periodic_field) lhs%f = rhs%f class default stop 'periodic_field%copy: unsupported right-hand-side class.' end select end subroutine end module program main use field_module use periodic_field_module implicit none class(field) ,pointer :: u,f u => new_periodic_field() f => new_periodic_field() f = u end program $ gfortran link_demo.f03 Undefined symbols: "_field_eq_field_", referenced from: _MAIN__ in ccFO42I9.o ld: symbol(s) not found collect2: ld returned 1 exit status -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42385