mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 14:16:42 +00:00

A non-elemental specific procedure must take precedence over an elemental specific procedure in defined operator generic resolution. Fixes https://github.com/llvm/llvm-project/issues/124777.
27 lines
546 B
Fortran
27 lines
546 B
Fortran
!RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty
|
|
!CHECK-NOT: error:
|
|
module m
|
|
type t
|
|
contains
|
|
procedure nonelemental
|
|
generic :: operator(+) => nonelemental
|
|
end type
|
|
interface operator(+)
|
|
procedure elemental
|
|
end interface
|
|
contains
|
|
type(t) elemental function elemental (a, b)
|
|
class(t), intent(in) :: a, b
|
|
elemental = t()
|
|
end
|
|
type(t) function nonelemental (a, b)
|
|
class(t), intent(in) :: a, b(:)
|
|
nonelemental = t()
|
|
end
|
|
end
|
|
program main
|
|
use m
|
|
type(t) x, y(1)
|
|
x = x + y ! ok
|
|
end
|