http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59103
Bug ID: 59103 Summary: [OOP] Reject deallocate/intent(out) for polymorphic var in PURE procedures (IR F08/0033) Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org (This PR is also motivated by https://groups.google.com/forum/#!topic/comp.lang.fortran/66iSG-kMZfo and https://groups.google.com/forum/#!topic/comp.lang.fortran/-NaOfgodyYc ) Interpretation request F08/0033, ftp://ftp.nag.co.uk/sc22wg5/N1851-N1900/N1875.txt, added additional restrictions to PURE as polymorphic variables might have IMPURE FINAL subroutines. Thus: * An INTENT(OUT) argument of a pure procedure should not be allowed to be polymorphic * deallocation of any polymorphic entity should be forbidden in a pure procedure. * Any statement that might result in a deallocation that is forbidden should not be allowed in a pure procedure. Or more formally: EDITS to 10-007r1: [24:10] 1.6.2p1 last sentence, "Any"->"Except as identified in this subclause, any". {This edit is also present in interp F08/0032.} [24:11+] 1.6.2 at end of subclause insert new paragraph: "Fortran 2003 permitted an INTENT(OUT) argument of a pure subroutine to be polymorphic. This is not permitted by this part of ISO/IEC 1539.". [312:23+] After C1278, insert new constraint: "C1278b An INTENT(OUT) dummy argument of a pure procedure shall not be polymorphic." [313:4+] After C1284, insert new constraint and note: "C1284a A statement that might result in the deallocation of a polymorphic entity is not permitted in a pure procedure. Note 12.48x Apart from the DEALLOCATE statement, this includes intrinsic assignment if the variable has a polymorphic allocatable component at any level of component selection that does not involve a pointer component but which might involve one or more allocatable components." Example: See interpretation request.