- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day,
compiler reports errors on line 12 (generic, public :: Set => Set_integer, Set_real):
- Error 1 error #5082: Syntax error, found ',' when expecting one of: ( % : . = => D:\FEM\_FemPnLin\_pokusy\81 Fortran - Generic\generic\generic module.f90 12
- Error 2 error #5082: Syntax error, found '=>' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; + . - % (/ [ : ] /) . ** / // ... D:\FEM\_FemPnLin\_pokusy\81 Fortran - Generic\generic\generic module.f90 12
I use a the compiler v 11.1.067. I can not find what I'm doing wrong?
Thank you
[fortran]
module Generic_test_mod
implicit none
private
type, public :: container
integer(4), private :: i = 0
real(8), private :: r = 0.
contains
private
procedure :: Set_integer
procedure :: Set_real
generic, public :: Set => Set_integer, Set_real
end type container
contains
subroutine Set_integer(this, val)
implicit none
class(container), intent(in out) :: this
integer(4), intent(in) :: val
this%i = val
end subroutine Set_integer
subroutine Set_real(this, val)
implicit none
class(container), intent(in out) :: this
real(8), intent(in) :: val
this%r = val
end subroutine Set_real
end module Generic_test_mod
[/fortran]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think you're doing anything wrong other than using an old compiler. I've tried your code in 13.1.0.149 and it compiles without error.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page