- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to use features of fortran 2003.
Problem is procedure bound to type.
I'm want my method "init" have couple of implementions
So I've tried to use "GENERIC" statement.
file_handler_module.f90(24): error #5082: Syntax error, found '::' when expecting one of: ( % : . = =>
generic :: init=> init_d,init_e
------------------------^
file_handler_module.f90(24): error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(24): error #6973: This is not a valid initialization expression. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(50): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [INIT_D]
subroutine init_d(f,name_prefix)
-------------------^
file_handler_module.f90(24): error #6404: This name does not have a type, and must have an explicit type. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
compilation aborted for file_handler_module.f90 (code 1)
code
is generic statement is supported?
Is there some other wayto do it?
Problem is procedure bound to type.
I'm want my method "init" have couple of implementions
So I've tried to use "GENERIC" statement.
file_handler_module.f90(24): error #5082: Syntax error, found '::' when expecting one of: ( % : . = =>
generic :: init=> init_d,init_e
------------------------^
file_handler_module.f90(24): error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(24): error #6973: This is not a valid initialization expression. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(50): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [INIT_D]
subroutine init_d(f,name_prefix)
-------------------^
file_handler_module.f90(24): error #6404: This name does not have a type, and must have an explicit type. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
compilation aborted for file_handler_module.f90 (code 1)
code
[bash]module file_handler_module IMPLICIT NONE type cfile_handler private character*55 ::file_name integer::file_handle contains ! procedure :: init procedure :: handle procedure :: name generic :: init=> init_d,init_e end type cfile_handler private current_handle integer::current_handle=1000! contains subroutine init_d(f,name_prefix) class (cfile_handler)::f character*25 ,intent(in) ::name_prefix end subroutine init_d subroutine init_e(f,name_prefix,name_ext) class (cfile_handler)::f character*25 ,intent(in) ::name_prefix character*25 ,intent(in) ::name_ext end subroutine init_e integer function handle(f) class (cfile_handler)::f handle=f%file_handle end function handle character*55 function name(f) class (cfile_handler)::f name=f%file_name end function name end module file_handler_module [/bash]Question: what's wrong?
is generic statement is supported?
Is there some other wayto do it?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the latest Release Notes there's a note for it:
Note: GENERIC attribute, FINAL procedures and type-bound operators are not supported in this release
mecej4 is right about the required specific binding. gfortran (v4.5) complains about it:
Error: Undefined specific binding 'init_e' as target of GENERIC 'init' at (1)
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe that you need to declare init_d and init_e as type-bound procedures before defining the generic name init on line-14.
Be that as it may, I don't think that the Intel Fortran compiler supports generic type-bound procedures yet (this statement is a candidate for correction if the Intel people comment on it).
Be that as it may, I don't think that the Intel Fortran compiler supports generic type-bound procedures yet (this statement is a candidate for correction if the Intel people comment on it).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the latest Release Notes there's a note for it:
Note: GENERIC attribute, FINAL procedures and type-bound operators are not supported in this release
mecej4 is right about the required specific binding. gfortran (v4.5) complains about it:
Error: Undefined specific binding 'init_e' as target of GENERIC 'init' at (1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks You Guys!
Now it's all clear. I hope generic statement will be included soon.
Now it's all clear. I hope generic statement will be included soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it will be in a release later this year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great news! I'm loooking forward to it.

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