- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the code below I get some errors regarding the use of the name "TRIM" as a type-bound procedure, since it's also used as a specification function:
[fortran]module mod1
implicit none
private
save
type, public :: t1
character(20) :: label
contains
procedure :: TRIM => TRIM_t1
end type
contains
pure function TRIM_t1(string) result(trimmed)
class(t1), allocatable :: trimmed
class(t1), intent(IN) :: string
allocate (trimmed, mold = string)
trimmed%label = TRIM(string%label)
end function
pure function blank(string) result(new)
character(*), intent(IN) :: string
character(LEN = LEN_TRIM(ADJUSTL(string)) - &
mycount(TRIM(ADJUSTL(string)), ' ')) :: new
new = ''
end function
pure function mycount(string, substring) result(many)
integer :: many
character(*), intent(IN) :: string
character(*), intent(IN) :: substring
integer :: i
many = 0
do i = 1, LEN(string)
many = many + (-1) ** i
enddo
end function
end module mod1
[/fortran] Am I doing something wrong here or is it just a bug in the compiler? When I compile with gfortran (v4.5, with source= instead of mold=) I don't get any error.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm looking at this now.
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