Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

81 lines
2.6 KiB
Fortran

!RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
module m
type :: tbps
contains
procedure, nopass :: fprocf, fprocs, ffunc1, ffunc2, ffunc3, fsub
end type
contains
function fprocf()
procedure(), pointer :: fprocf
fprocf => func
end
function fprocs()
procedure(), pointer :: fprocs
fprocs => sub
end
function ffunc1()
procedure(), pointer :: ffunc1
real ffunc1
ffunc1 => func
end
function ffunc2()
procedure(real), pointer :: ffunc2
ffunc2 => func
end
function ffunc3()
procedure(func), pointer :: ffunc3
ffunc3 => func
end
function fsub()
procedure(sub), pointer :: fsub
fsub => sub
end
subroutine sub
end
function func()
func = 0.
end
end
program p
use m
type(tbps) :: x
procedure(), pointer :: gp
procedure(real), pointer :: rfp
procedure(sub), pointer :: sp
gp => x%fprocf() ! procedure() always ok to assign any procedure to
gp => x%fprocs()
gp => x%ffunc1()
gp => x%ffunc2()
gp => x%ffunc3()
gp => x%fsub()
rfp => x%fprocf() ! can be assigned a procedure() function result
rfp => x%fprocs() ! can be assigned a procedure() function result
rfp => x%ffunc1()
rfp => x%ffunc2()
rfp => x%ffunc3()
!ERROR: Procedure pointer 'rfp' associated with result of reference to function 'fsub' that is an incompatible procedure pointer: incompatible procedures: one is a function, the other a subroutine
rfp => x%fsub()
sp => x%fprocf() ! can be assigned a procedure() function result
sp => x%fprocs() ! can be assigned a procedure() function result
!ERROR: Procedure pointer 'sp' associated with result of reference to function 'ffunc1' that is an incompatible procedure pointer: incompatible procedures: one is a function, the other a subroutine
sp => x%ffunc1()
!ERROR: Procedure pointer 'sp' associated with result of reference to function 'ffunc2' that is an incompatible procedure pointer: incompatible procedures: one is a function, the other a subroutine
sp => x%ffunc2()
!ERROR: Procedure pointer 'sp' associated with result of reference to function 'ffunc3' that is an incompatible procedure pointer: incompatible procedures: one is a function, the other a subroutine
sp => x%ffunc3()
sp => x%fsub()
!ERROR: Binding 'fprocf' is not a subroutine
call x%fprocf()
!ERROR: Binding 'fprocs' is not a subroutine
call x%fprocs()
!ERROR: Binding 'ffunc1' is not a subroutine
call x%ffunc1()
!ERROR: Binding 'ffunc2' is not a subroutine
call x%ffunc2()
!ERROR: Binding 'ffunc3' is not a subroutine
call x%ffunc3()
!ERROR: Binding 'fsub' is not a subroutine
call x%fsub()
end