https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89645

            Bug ID: 89645
           Summary: No IMPLICIT type error with: ASSOCIATE( X =>
                    function() )
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian_harvey at bigpond dot com
  Target Milestone: ---

The module:

  MODULE m
    IMPLICIT NONE
    TYPE :: t
      INTEGER :: comp
    END TYPE t
  CONTAINS
    SUBROUTINE s
      ASSOCIATE(b => fun())
        PRINT *, b%comp
      END ASSOCIATE
    END SUBROUTINE s

    FUNCTION fun() RESULT(r)
      TYPE(t) :: r
      r = t(1)
    END FUNCTION fun
  END MODULE m

when compiled with recent trunk (r269545) gives:

      9 |       PRINT *, b%comp
        |                 1
  Error: Symbol ‘b’ at (1) has no IMPLICIT type

F2003 rules (8.1.4.2) and subsequent standards state for the associate
statement that the entity identified by the associate name assumes the declared
type of the selector.

(This has some similarity to pr60483, which related to structure constructors.)

Reply via email to