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

--- Comment #3 from Damian Rouson <damian at archaeologic dot codes> ---
Hooray!!  Thanks, Paul.

D

On Sat, Aug 9, 2025 at 02:56 pault at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121398
>
> --- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
> Created attachment 62087
>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62087&action=edit
> First attempt at a fix - work in progress!
>
> The test below runs correctly with this patch applied. ifx and flang-new
> accept
> it and produce the same result. Nagfor doesn't like the interfaces for some
> reason.
>
> The chunk in decl.cc is a proper fix for the PDT part. The zeroed out
> chunks in
> resolve.cc are necessary to prevent errors and will be subject to
> investigation
> one after another.
>
> Paul
>
> module tensor_m
>   implicit none
>
>   type tensor_t(k)
>     integer, kind :: k
>   contains
>     procedure default_real_num_components
>     procedure double_precision_num_components
>     generic :: num_components => default_real_num_components, &
>                                  double_precision_num_components
>   end type
>
>   interface
>
>     module function default_real_num_components(self) result(res)
>       implicit none
>       class(tensor_t(kind(0.))) self
>       integer :: res
>     end function
>
>     module function double_precision_num_components(self) result(res)
>       implicit none
>       class(tensor_t(kind(0.0_16))) self
>       integer :: res
>     end function
>
>   end interface
>
> end module
>
> submodule (tensor_m) tensor_m_components
> contains
>     module procedure default_real_num_components
>       implicit none
>       res = 1
>     end
>
>     module procedure double_precision_num_components
>       implicit none
>       res = 2
>     end
> end
>
>     use tensor_m
>     type (tensor_t(kind(0.))) :: a
>     type (tensor_t(kind(0.0_16))) :: b
>     print *, a%num_components ()
>     print *, b%num_components ()
> end
>
> --
> You are receiving this mail because:
> You reported the bug.

Reply via email to