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

            Bug ID: 123208
           Summary: Private component statements rejected inside
                    submodules
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikael at gcc dot gnu.org
  Target Milestone: ---

This is rejected, I think it is valid:

module m
  interface
    pure module subroutine s()
    end subroutine
  end interface
end module

submodule (m) sm
  type :: t
    private
  end type
end submodule



$ gfortran -fsyntax-only -std=f2023 -c test.f90 
test.f90:10:11:

   10 |     private
      |           1
Error: PRIVATE statement at (1) is only allowed in the specification part of a
module

$ gfortran --version
GNU Fortran (Debian 15.2.0-11) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I also checked with a 16.0 trunk version from early november 2025, with the
same output.

Reply via email to