replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - module procedures, derived types
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

module procedures, derived types

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
JohnMansell



Joined: 10 May 2006
Posts: 18
Location: Darlington

PostPosted: Tue Jun 18, 2013 1:33 pm    Post subject: module procedures, derived types Reply with quote

This example won't compile.I'm using ftn95 6.20. gfortran and the Lahey f95 checker say its OK (but insist on sequence for TYPE_A & TYPE_B, required by example_A_T and example_B_T ).
The compilation error is in B_TO_STR. The message states that ASSIGN_S_A expects the second dummy argument to be type TYPE_A (true, but shouldn't = resolve to ASSIGN_S_B?), whereas what is supplied is TYPE_B.

Remove sequence from TYPE_A and TYPE_B and ftn95 says all is OK.

Code:

module TESTAB
!
    implicit none
!
    type type_A
    sequence
       character(8) ch
    end type
    type type_B
    sequence
       character(8) ch
    end type
!
    interface assignment(=)
       module procedure assign_A_S,assign_B_S,assign_S_A,assign_S_B
    end interface
contains
!================================================================================
      subroutine assign_A_S(a,s)
      character(8),intent(in) :: s
      type(type_A),intent(inout) :: a
      a%ch = s
      end subroutine
!================================================================================
      subroutine assign_B_S(b,s)
      character(8),intent(in) :: s
      type(type_B),intent(inout) :: b
      b%ch = s
      end subroutine
!================================================================================
      subroutine assign_S_A(s,a)
      character(8),intent(inout) :: s
      type(type_A),intent(in) :: a
      s = a%ch
      end subroutine
!================================================================================
      subroutine assign_S_B(s,b)
      character(8),intent(inout) :: s
      type(type_B),intent(in) :: b
      s = b%ch
      end subroutine


end module TESTAB
module TEST_DATA
    use TESTAB
    implicit none
!
    type example_A_T
    sequence
       type(type_A)    A
       real x,y,z
    end type example_A_T
    type example_B_T
    sequence
       type(type_B)    B
       integer flag
    end type example_B_T
contains
!================================================================================
      function A_to_str(from) result (s)
      implicit none
      type(type_A) from
      character(8) s
      s = from
      end function
!================================================================================
      function B_to_str(from) result (s)
      implicit none
      type(type_B) from
      character(8) s
      s = from
      end function

end module TEST_DATA
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Tue Jun 18, 2013 5:24 pm    Post subject: Reply with quote

I have logged this for investigation.
Back to top
View user's profile Send private message AIM Address
JohnMansell



Joined: 10 May 2006
Posts: 18
Location: Darlington

PostPosted: Wed Jun 19, 2013 8:17 am    Post subject: Reply with quote

Thanks. I have also asked the same question in comp.lang.fortran under "is this f95-compliant".
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Fri Mar 14, 2014 2:16 pm    Post subject: Reply with quote

This bug has now been fixed for the next release.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group