- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
with the following example :
module m_alloc
implicit none
interface alloc
module procedure alloc_a , alloc_p
end interface
contains
subroutine alloc_a(n,a)
integer, intent(in) :: n
real*8, allocatable :: a(:)
allocate(a(n))
end subroutine alloc_a
subroutine alloc_p(n,p)
integer, intent(in) :: n
real*8, pointer :: p(:)
allocate(p(n))
end subroutine alloc_p
end module m_alloc
I get the error :
The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name.
Isn't the compiler supposed to make a difference between allocatable and pointer types ?
with the following example :
module m_alloc
implicit none
interface alloc
module procedure alloc_a , alloc_p
end interface
contains
subroutine alloc_a(n,a)
integer, intent(in) :: n
real*8, allocatable :: a(:)
allocate(a(n))
end subroutine alloc_a
subroutine alloc_p(n,p)
integer, intent(in) :: n
real*8, pointer :: p(:)
allocate(p(n))
end subroutine alloc_p
end module m_alloc
I get the error :
The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name.
Isn't the compiler supposed to make a difference between allocatable and pointer types ?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No. The only attributes used for generic interface matching are type, kind and rank.

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