Issue 148678
Summary [flang] Incorrect diagnostic on defined operator
Labels flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code:
```
module m
  type dt
    integer i
  contains
 procedure, pass(x) :: add => addmp
    generic, private :: OPERATOR(+) => add
  end type

  interface OPERATOR(+)
    module procedure addmp
  end interface
contains
  type(dt) function addmp(y,x)
    class(dt), intent(in) :: x
    integer, intent(in) :: y
    addmp%i = x%i + y + 1
 end function

end module
```

Flang complains:
```
error: Semantic errors in genop03.f
./genop03.f:8:25: error: Generic 'OPERATOR(+)' may not have specific procedures 'addmp' and 'dt%add' as their interfaces are not distinguishable
      generic, private :: OPERATOR(+) => add
 ^^^^^^^^^^^
./genop03.f:15:21: Declaration of 'addmp'
 type(dt) function addmp(y,x)
                      ^^^^^
./genop03.f:7:27: Declaration of 'add'
      procedure, pass(x) :: add => addmp
 ^^^
./genop03.f:15:21: Procedure 'add' of type 'dt' is bound to 'addmp'
    type(dt) function addmp(y,x)
 ^^^^^
```

All ifort, gfortran and XLF compiles the code successfully. 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to