[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 13:12:10 PDT 2025


klausler wrote:

> You are right. I got the code wrong. Repost here.
> 
> ```
>    type base
>      character(2) :: c1
>      integer(2) :: i1
>      character(kind(i1)) :: c2
>      character(c1%len) :: c3
>    end type
>    type(base) :: b1
>    print*, b1%c1%len
>    print*, b1%c2%len
>    print*, b1%c3%len
> end
> ```
> 
> It should be `character(c1%len) :: c3`.

You can't reference the component `c1` within the derived type definition.  `c1` is not a type parameter.

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


More information about the flang-commits mailing list