On Wed, Jul 23, 2025 at 05:53:17PM +0100, Paul Richard Thomas wrote: > > The attached implements the F2018 generic statement, which has the same > semantics as the typebound version but can appear in any specification > statement. > > As it says in the first comment in the patch, use is made of the existing, > typebound matching functions to obtain access-spec and generic-spec. After > this the standard INTERFACE machinery is used. > > I spent a stupidly long time allowing the mixing of generic statements with > generic interfaces until I realised that I was accepting ST_GENERIC in the > wrong place in parse_spec :-( > > Regtests on x86_64/FC42 - OK for mainline? >
Hi Paul, I think the code following my .sig should compile and execute % gfcx -o z a.F90 && ./z 42.0000000 43.5000000 % gfcx -o z -DGEN a.F90 a.F90:9:21: 9 | generic :: bar => bar, bah | 1 Error: There's already a non-generic procedure with binding name 'bar' at (1) The 'interface bar ... end interface bar' is an idiom that I use throughout my math library. -- steve module foo implicit none private public bar #ifdef GEN generic :: bar => bar, bah #else ! ! Should be equivalent to above. ! interface bar module procedure bar module procedure bah end interface bar #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 *, bar(42) print *, bar(43.5) end program snooze