- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I find pass/nopass kind of error quite confusing, please consider following code:
program foo
implicit none
interface
subroutine foo_P(dummy)
implicit none
real, intent(in) :: dummy
end subroutine foo_P
end interface
type :: foo_T
procedure(foo_P), pointer :: func
end type
end program foo
Procedure pointer func in type foo_T is obviously missing nopass attribute. This is what ifort reports:
foo.f90(5): error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined. [DUMMY]
subroutine foo_P(dummy)
-----------------------^
compilation aborted for foo.f90 (code 1)
It took me quite a while to find the actual cause. To compare that's the output of gfortran-4.6:
foo.f90:12.39:
procedure(foo_P), pointer :: func
1
Error: Argument 'dummy' of 'func' with PASS(dummy) at (1) must be of the derived type 'foo_t'
Would it be possible to enhance the compiler logic for this case?
Best regards,
Kacper Kowalik
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page