summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/interface_1.f90
blob: e170f870e1a4a39a31e3bc62b7b9b260b5430cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
! { dg-do compile }
! This program would segfault without the patch for PR fortran/24005.
module y
  !
  ! If private statement is removed, then we get a bunch of errors
  !
  private f
  !
  ! If we rename 'f' in module y to say 'g', then gfortran correctly
  ! identifies ambiguous as being ambiguous.
  !
  interface ambiguous
    module procedure f
  end interface

  contains

    real function f(a)
      real a
      f = a
    end function

end module y

module z

  use y

  interface ambiguous
    module procedure f    ! { dg-warning "in generic interface" "" }
  end interface

  contains

    real function f(a)
      real a
      f = a
    end function

end module z

! { dg-final { cleanup-modules "y z" } }