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

            Bug ID: 122089
           Summary: generic resolution problem with composite PDT
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at archaeologic dot codes
  Target Milestone: ---

$ cat all.f90
module tensor_m
  implicit none

  type tensor_t(k)
    integer, kind :: k = kind(1.)
    real(k) values_
  contains
    generic :: values => double_precision_values
    procedure double_precision_values
  end type

contains
  function double_precision_values(self)
    class(tensor_t(kind(1D0))) self
    double precision double_precision_values
    double_precision_values = self%values_
  end function
end module

module input_output_pair_m
  use tensor_m, only : tensor_t
  implicit none

  type input_output_pair_t(k)
    integer, kind :: k = kind(1.)
    type(tensor_t(k)) inputs_
  end type

  interface
    module subroutine double_precision_write_to_stdout(input_output_pairs)
      implicit none
      type(input_output_pair_t(kind(1D0))) input_output_pairs
    end subroutine
  end interface
end module

submodule(input_output_pair_m) input_output_pair_s
  implicit none
contains
  module procedure double_precision_write_to_stdout
    print *, input_output_pairs%inputs_%values()
  end procedure
end submodule

$ gfortran -c all.f90
all.f90:41:12:

   41 |     print *, input_output_pairs%inputs_%values()
      |            1
Error: Found no matching specific binding for the call to the GENERIC ‘values’
at (1)

$ gfortran --version
GNU Fortran (GCC) 16.0.0 20250926 (experimental)

Reply via email to