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

            Bug ID: 128879
           Summary: ASSOCIATE to element of derived-type PARAMETER array:
                    “Symbol has no IMPLICIT type”
           Product: gcc
           Version: 16.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.pribec at gmail dot com
  Target Milestone: ---

ASSOCIATE with an element of a local derived-type named constant array gives

!   Error: Symbol 't' at (1) has no IMPLICIT type

program main
  implicit none
  type :: t_
    integer :: k
  end type
  type(t_), parameter :: tab(2) = [t_(3), t_(4)]
  associate (t => tab(2))                          ! <- FAILS here
    print '(i0)', t%k
  end associate
end program


Same error occurs in gfortran 13.3, 14.2, 15.2 and 16.2. 

Works in flang, ifx, nvfortran, printing the number 4. 

It works if I add an extra pair of brackets:

 associate (t => (tab(2)))

Reply via email to