[Flang] GENERIC INTERFACE: Incorrect diagnose when the proc-interface of a procedure pointer is a function that returns polymorphic pointer
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.
@llvm/issue-subscribers-bug
Author: Daniel Chen (DanielCChen)
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.
</details>
@llvm/issue-subscribers-flang-frontend
Author: Daniel Chen (DanielCChen)
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.
</details>
The test case in the issue compiles successfully now. Just to confirm that PR #82837 fixed this issue.