Skip to content

[Flang] GENERIC INTERFACE: Incorrect diagnose when the proc-interface of a procedure pointer is a function that returns polymorphic pointer #82390

@DanielCChen

Description

@DanielCChen

Consider the following code:

  MODULE M

    TYPE :: DT
      INTEGER :: ID
    END TYPE

    CONTAINS

    FUNCTION ModDt(Arg)
    TYPE(DT) :: Arg
    CLASS(DT), POINTER :: ModDt
    END FUNCTION

  END MODULE

  PROGRAM PtrAssignGen
  USE M
  IMPLICIT NONE

  INTERFACE ModDt
    MODULE PROCEDURE  ModDt
  END INTERFACE

  PROCEDURE(ModDt), POINTER :: ProcPtr

  END

Flang currently issues an error as

./t.f:21:5: error: A PROCEDURE statement is only allowed in a generic interface block
    MODULE PROCEDURE  ModDt
    ^^^^^^^^^^^^^^^^^^^^^^^

The code seems conforming to me. If I remove the generic name from the interface block, it compiles successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorflang:frontend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions