https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122501
Bug ID: 122501
Summary: [PDT] generic interface not recognized for
user-defined structure constructor
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 tensor_m
implicit none
type tensor_t(k)
integer, kind :: k = kind(1.)
real(k), allocatable, private :: values_(:)
contains
procedure default_real_values
end type
interface tensor_t
type(tensor_t) module function construct_default_real(values)
implicit none
real values(:)
end function
end interface
interface
module function default_real_values(self) result(tensor_values)
implicit none
class(tensor_t) self
real, allocatable :: tensor_values(:)
end function
end interface
end module
use tensor_m
implicit none
contains
function copy(tensor)
type(tensor_t) tensor, copy
associate(tensor_values => tensor%default_real_values())
copy = tensor_t(tensor_values)
end associate
end function
end
$ gfortran reproducer.f90
reproducer.f90:33:14:
33 | copy = tensor_t(tensor_values)
| 1
Error: Component ‘values_’ at (1) is a PRIVATE component of ‘tensor_t’
$ gfortran --version
GNU Fortran (GCC) 16.0.0 20251027 (experimental)