On Sun, Aug 03, 2025 at 12:20:24PM +0100, Paul Richard Thomas wrote:

First, the easy one:

> +  /* Match the binding name; depending on type (operator / generic) format
> +     it for future error messages into bind_name.  */

This comment looks muddled.

> +       if (op_type == INTERFACE_GENERIC && !generic_spec->attr.generic)
> +         {
> +           gfc_error ("There's already a non-generic procedure with "
> +                      "binding name %qs at %C", generic_spec->name);
> +           goto error;

The contraction should probably be expanded to make
translation to other languages easier.  I also find
the error message to be unclear for

   module foo
      implicit none
      private

      ! F2023:C815 An entity shall not be explicitly given any
      ! attribute more than once in a scoping unit.
      public bar
      generic, public :: bar => bah, bak

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

% gfcx -c -fmax-errors=1 generic_stmt_3.F90 
generic_stmt_3.F90:7:32:

    7 |       generic, public :: bar => bah, bak
      |                                1
Error: There's already a non-generic procedure with binding name 'bar' at (1)

If you invert the statements to 

      generic, public :: bar => bah, bak
      public bar

% gfcx -c -fmax-errors=1 generic_stmt_3.F90
generic_stmt_3.F90:7:16:

    7 |       public bar
      |                1
Error: ACCESS specification at (1) was already specified

The error is quite clear.  This also generates an error

      public bar
      generic :: bar => bah, bak

while

      generic :: bar => bah, bak
      public bar

compiles without error.

-- 
steve

Reply via email to