On Wed, Jul 23, 2025 at 05:53:17PM +0100, Paul Richard Thomas wrote:
> 
> 
> Regtests on x86_64/FC42 - OK for mainline?
> 

Here's another testcase that fails.

% gfcx -o z a_gen2.F90 && ./z
   42.0000000    
   43.5000000    

% gfcx -o z -DGEN a_gen2.F90
a_gen2.F90:9:21:

    9 |    generic :: bak => bar, bah
      |                     1
Error: There's already a non-generic procedure with binding name 'bak' at (1)
a_gen2.F90:6:13:

    6 |    public bak
      |             1
Error: Symbol 'bak' at (1) has no IMPLICIT type; did you mean 'bar'?

It seems that 

module foo
  implicit none
  private
  public bar
  generic :: bar =>...
end module
  
is not accepted.

-- 
steve

module foo

   implicit none

   private
   public bak

#ifdef GEN
   generic :: bak => bar, bah
#else
   !
   ! Should be equivalent to above.
   !
   interface bak
      module procedure bar
      module procedure bah
   end interface bak
#endif

   contains
      function bar(i)
         real bar
         integer, intent(in) :: i
         bar = i
      end function bar
      function bah(x)
         real bah
         real, intent(in) :: x
         bah = x
      end function bah
end module foo

program snooze
   use foo
   print *, bak(42)
   print *, bak(43.5)
end program snooze


Reply via email to