From patchwork Wed Jun 23 21:38:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Fortran] PR 44614 Fix diagnostic for IMPORTing CLASS symbols Date: Wed, 23 Jun 2010 11:38:12 -0000 From: Tobias Burnus X-Patchwork-Id: 56728 Message-Id: <4C227EC4.5000003@net-b.de> To: gcc patches , gfortran gfortran did not diagnose the use of non-IMPORTed derived types, if they were used as CLASS - it only diagnosed TYPE. The patch is on the verge of being obvious. Build and currently regtesting on x86-64-linux. If it succeeds: OK for the trunk? Tobias 2010-06-23 Tobias Burnus PR fortran/44614 * decl.c (variable_decl): Fix IMPORT diagnostic for CLASS. 2010-06-23 Tobias Burnus PR fortran/44614 * gfortran.dg/import8.f90: New. Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (Revision 161288) +++ gcc/fortran/decl.c (Arbeitskopie) @@ -1764,7 +1764,7 @@ variable_decl (int elem) specified in the procedure definition, except that the interface may specify a procedure that is not pure if the procedure is defined to be pure(12.3.2). */ - if (current_ts.type == BT_DERIVED + if ((current_ts.type == BT_DERIVED || current_ts.type == BT_CLASS) && gfc_current_ns->proc_name && gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY && current_ts.u.derived->ns != gfc_current_ns) Index: gcc/testsuite/gfortran.dg/import8.f90 =================================================================== --- gcc/testsuite/gfortran.dg/import8.f90 (Revision 0) +++ gcc/testsuite/gfortran.dg/import8.f90 (Revision 0) @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! PR fortran/44614 +! +! + +implicit none + +type, abstract :: Connection +end type Connection + +abstract interface + subroutine generic_desc(self) + ! <<< missing IMPORT + class(Connection) :: self ! { dg-error "has not been declared within the interface" } + end subroutine generic_desc +end interface +end