Issue |
129726
|
Summary |
[Flang] Error due to order of specific procedures in generic interface
|
Labels |
flang
|
Assignees |
|
Reporter |
ivan-pi
|
Given the following module, simply changing the order of the specific procedure in a type-bound method results in an error:
```fortran
module collisions
implicit none
type :: Spaceship
contains
#ifdef WORKING
procedure, private, pass(x) :: collide_x => collide_ss, collide_sa ! Works
#else
procedure, private, pass(x) :: collide_x => collide_sa, collide_ss ! Breaks
#endif
procedure, private, pass(y) :: collide_y => collide_as
generic :: collide => collide_x, collide_y
end type
type :: Asteroid
end type
contains
subroutine collide_as(x,y)
class(Asteroid) :: x
class(Spaceship) :: y
print *, "a/s"
end subroutine
subroutine collide_sa(x,y)
class(Spaceship) :: x
class(Asteroid) :: y
print *, "s/a"
end subroutine
subroutine collide_ss(x,y)
class(Spaceship) :: x
class(Spaceship) :: y
print *, "s/s"
end subroutine
end module
```
```
$ flang-new -c c4.F90
error: Semantic errors in c4.F90
./c4.F90:12:16: error: Generic 'collide' may not have specific procedures 'collide_x' and 'collide_y' as their interfaces are not distinguishable
generic :: collide => collide_x, collide_y
^^^^^^^
./c4.F90:25:12: Procedure 'collide_x' of type 'spaceship' is bound to 'collide_sa'
subroutine collide_sa(x,y)
^^^^^^^^^^
./c4.F90:20:12: Procedure 'collide_y' of type 'spaceship' is bound to 'collide_as'
subroutine collide_as(x,y)
^^^^^^^^^^
$ flang-new -c -DWORKING c4.F90
$ flang-new --version
Homebrew flang-new version 19.1.4
Target: x86_64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /usr/local/Cellar/flang/19.1.4/libexec
Configuration file: /usr/local/Cellar/flang/19.1.4/libexec/flang.cfg
Configuration file: /usr/local/etc/clang/x86_64-apple-darwin23.cfg
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs