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

            Bug ID: 101735
           Summary: Type parameter inquiries for substrings are rejected
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

As noted by Tobias Burnus in pr100950, type parameter inquiries
(see e.g. F2018:9.4.5) are not recognized for substrings.

character(len=5)   :: str
integer, parameter :: j = str% kind      ! accepted (ok)
integer, parameter :: k = str% len       ! accepted (ok)
integer, parameter :: l = str(1:3)% len  ! not accepted
integer, parameter :: m = str(1:3)% kind ! not accepted
end

gives:

pr100950-inq.f90:4:25:

    4 | integer, parameter :: l = str(1:3)% len  ! not accepted
      |                         1
Error: Parameter 'str' at (1) has not been declared or is a variable, which
does not reduce to a constant expression
pr100950-inq.f90:5:25:

    5 | integer, parameter :: m = str(1:3)% kind ! not accepted
      |                         1
Error: Parameter 'str' at (1) has not been declared or is a variable, which
does not reduce to a constant expression

Reply via email to