Issue 167337
Summary [flang]PDT: Incorrect diagnostic on default init with PDT
Labels flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code:
```
  MODULE M

  TYPE :: DT(K1,K2)    ! (4,8)
 INTEGER, KIND :: K1,K2
    INTEGER(K1)   :: I=-2
    COMPLEX(K2)   :: Cmpx=(3.0, 4.0)
  END TYPE

  TYPE :: DT1(K3,K4)    ! (4,8)
    INTEGER, KIND   :: K3,K4
    TYPE(DT(K3,K4)) :: Comp=DT(K3,K4)(I=4)
  END TYPE

 TYPE(DT1(4,8)) ::  T1

  END
```

Flang complains:
```
t.f:11:29: error: Structure constructor lacks a value for component 'cmpx'
 TYPE(DT(K3,K4)) :: Comp=DT(K3,K4)(I=4)
 ^^
./t.f:14:3: in the context: instantiation of parameterized derived type 'dt1(k3=4_4,k4=8_4)'
    TYPE(DT1(4,8)) ::  T1
 ^^^^^^^^^^^^^^^^^^^^^
./t.f:6:22: Declaration of 'cmpx'
      COMPLEX(K2) :: Cmpx=(3.0, 4.0)
                       ^^^^
```

The `Cmpx` component should be using its default initialization.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to