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

            Bug ID: 121960
           Summary: [PDT] Wrongly accepts type parameter of
                    non-type-parameter member
           Product: gcc
           Version: 16.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
                CC: pault at gcc dot gnu.org
  Target Milestone: ---

The following compiles but shouldn't:

implicit none (type, external)
type t
  integer :: x
end type t

contains
  subroutine s2(y)
    type(t(x=5)) :: y
        ! ^^^^^^
  end
end

ifx rejects this with:
  error #8724: A type parameter spec list may only appear if the type is
parameterized.   [X]


F2023: "7.5.9 Derived-type specifier"

R754 derived-type-spec is type-name [ ( type-param-spec-list ) ]

C796 (R754) type-param-spec-list shall appear only if the type is
parameterized.
C797 (R754) There shall be at most one type-param-spec corresponding to each
parameter of the type. If a type parameter does not have a default value, there
shall be a type-param-spec corresponding to that type parameter.

Reply via email to