Skip to content

[flang] Default initialization failure #161989

@DanielCChen

Description

@DanielCChen

Consider the following code:

 type Base integer :: i /-1/ end type type, extends(Base) :: Child integer :: j /-3/ end type type(Child) :: c1 = Child(1000) print*, c1%i print*, c1%j end 

Flang complains:

./t.f:10:24: error: Structure constructor lacks a value for component 'j' type(Child) :: c1 = Child(1000) ^^^^^ ./t.f:7:18: Declaration of 'j' integer :: j /-3/ ^ 

It works if I use integer :: i = -1 instead.
It also works if I use "empty" constructor as type(child) :: c1

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions