Skip to content

[flang] Structure constructor issue with parent component #161887

@DanielCChen

Description

@DanielCChen

Consider the following code:

program main

    type A
        class(*), pointer :: u1(:)
    end type

    type, extends(A) :: B
    end type

    type(B), target :: b1
    type(A), pointer :: ptr(:)

    allocate(ptr(2))

    b1 = B(ptr)     !! FAIL
!    b1 = B(u1=ptr)  !! WORK

end program

When the u1 component is of unlimited-poly, Flang seems take ptr as the parent component in the structure constructor because it is of type A.
However, the standard seems requires component keyword for the parent component.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions