brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 0b7148f Raw
42 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror2! F'2023 C7108 is portably unenforced.3module m4  type foo5    integer n6  end type7  interface foo8    procedure bar0, bar1, bar2, bar39  end interface10 contains11  type(foo) function bar0(n)12    integer, intent(in) :: n13    print *, 'bar0'14    bar0%n = n15  end16  type(foo) function bar1()17    print *, 'bar1'18    bar1%n = 119  end20  type(foo) function bar2(a)21    real, intent(in) :: a22    print *, 'bar2'23    bar2%n = a24  end25  type(foo) function bar3(L)26    logical, intent(in) :: L27    print *, 'bar3'28    bar3%n = merge(4,5,L)29  end30end31 32program p33  use m34  type(foo) x35  x = foo(); print *, x       ! ok, not ambiguous36  !PORTABILITY: Reference to generic function 'foo' (resolving to specific 'bar0') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]37  x = foo(2); print *, x      ! ambigous38  !PORTABILITY: Reference to generic function 'foo' (resolving to specific 'bar2') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]39  x = foo(3.); print *, x     ! ambiguous due to data conversion40  x = foo(.true.); print *, x ! ok, not ambigous41end42