mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 15:16:36 +00:00

Entities declared with CLASS() must be dummy arguments, allocatables, or pointers. This constraint check is currently correct for objects but not for procedures, and getting it right needs to avoid being confused between pointers to procedures and pointers returned by procedures. Differential Revision: https://reviews.llvm.org/D155491
25 lines
891 B
Fortran
25 lines
891 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! C708 An entity declared with the CLASS keyword shall be a dummy argument
|
|
! or have the ALLOCATABLE or POINTER attribute.
|
|
subroutine s()
|
|
type :: parentType
|
|
end type
|
|
|
|
class(parentType), pointer :: pvar
|
|
class(parentType), allocatable :: avar
|
|
class(*), allocatable :: starAllocatableVar
|
|
class(*), pointer :: starPointerVar
|
|
!ERROR: CLASS entity 'barevar' must be a dummy argument, allocatable, or object pointer
|
|
class(parentType) :: bareVar
|
|
!ERROR: CLASS entity 'starvar' must be a dummy argument, allocatable, or object pointer
|
|
class(*) :: starVar
|
|
|
|
contains
|
|
subroutine inner(arg1, arg2, arg3, arg4, arg5)
|
|
class (parenttype) :: arg1, arg3
|
|
type(parentType) :: arg2
|
|
class (parenttype), pointer :: arg4
|
|
class (parenttype), allocatable :: arg5
|
|
end subroutine inner
|
|
end subroutine s
|