[flang-commits] [flang] [flang] Rework component KIND= values in PDT instantiations (PR #162367)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Oct 8 12:53:33 PDT 2025


klausler wrote:

> The full test case of the reducer is indeed fixed. Thanks!
> 
> The following is for the LEN= parameter of the character type.
> 
> ```
>    type base
>      character(2) :: c1
>      integer(2) :: i1
>      character(kind(i1)) :: c2
>      character(len(c1)) :: c3
>    end type
>    type(base) :: b1
>    print*, b1%c1%len
>    print*, b1%c2%len
>    print*, b1%c3%len
> end
> ```
> 
> The expected output
> 
> ```
> > a.out
>  2
>  2
>  2
> ```
> 
> But Flang failed to compile it.
> 
> Should I open a new issue?

No; it's not valid Fortran.  You can't refer to components in a derived type definition, only to type parameters and to the type itself.

https://github.com/llvm/llvm-project/pull/162367


More information about the flang-commits mailing list