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

            Bug ID: 122290
           Summary: gfortan rejects real intrinsic in default
                    initialization & generic binding
           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 reproducer.f90 
module hyperparameters_m
  implicit none

  type hyperparameters_t(k)
    integer, kind :: k = kind(1.)
    real(k) :: learning_rate_ = real(1.5,k)
  contains
    generic :: operator(==) => default_real_equals
    procedure default_real_equals
  end type

  interface
    logical module function default_real_equals(lhs, rhs)
      implicit none
      class(hyperparameters_t), intent(in) :: lhs, rhs
    end function
  end interface

end module

$ gfortran -c reproducer.f90 
reproducer.f90:6:41:

    6 |     real(k) :: learning_rate_ = real(1.5,k)
      |                                         1
Error: Invalid kind for REAL at (1)
reproducer.f90:8:30:

    8 |     generic :: operator(==) => default_real_equals
      |                              1
Error: Entity ‘default_real_equals’ at (1) is already present in the interface

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

Reply via email to