From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25306 invoked by alias); 29 Sep 2010 15:54:33 -0000 Received: (qmail 25298 invoked by uid 22791); 29 Sep 2010 15:54:32 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Sep 2010 15:54:26 +0000 From: "ortp21 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ortp21 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 29 Sep 2010 20:27:00 -0000 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-09/txt/msg03141.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836 Summary: Fortran 2003 - Type Bound Procedure Error - Type Mismatch Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: ortp21@gmail.com The following error is produced by the example typeboundprocedure.f95, pasted below: Error ---------------------------------------------- typeboundprocedure.f95:46.12: print *, b_type_instance%sizeReturn() 1 Error: Type mismatch in argument 'a_type_' at (1); passed TYPE(b_type) to CLASS(a_type) ---------------------------------------------- I have tested the same example using the Intel Fortran Compiler 11.1 on Linux and it compiles without error. Compiled using: gfortran -c typeboundprocedure.f95 typeboundprocedure.f95 ---------------------------------------------- module A implicit none type :: a_type private integer :: size = 1 contains procedure :: sizeReturn end type a_type contains function sizeReturn( a_type_ ) implicit none integer :: sizeReturn class(a_type) :: a_type_ sizeReturn = a_type_%size end function sizeReturn end module A module B implicit none type :: b_type private integer :: size = 2 contains procedure :: sizeReturn end type b_type contains function sizeReturn( b_type_ ) implicit none integer :: sizeReturn class(b_type) :: b_type_ sizeReturn = b_type_%size end function sizeReturn end module B program main use A use B implicit none type(a_type) :: a_type_instance type(b_type) :: b_type_instance print *, a_type_instance%sizeReturn() print *, b_type_instance%sizeReturn() end program main ---------------------------------------------- Using built-in specs. COLLECT_GCC=gfortran Target: x86_64-apple-darwin10.4.0 Configured with: ../gcc-4.6-20100925/configure --prefix=~$HOME/gcc-trunk --enable-languages=fortran --enable-checking=release --disable-bootstrap Thread model: posix gcc version 4.6.0 20100925 (experimental) (GCC)