aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/derived_function_interface_1.f90
blob: 24a009509128f9ba121370cbd031ef567042ad8e (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
43
44
! { dg-do compile }
! Tests the fix for PR29634, in which an ICE would occur in the
! interface declaration of a function with an 'old-style' type
! declaration.  When fixed, it was found that the error message
! was not very helpful - this was fixed.
!
! Contributed by Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
!
module kinds
  type foo
    integer :: i
  end type foo
end module

type(foo) function ext_fun()
  use kinds
  ext_fun%i = 1
end function ext_fun

  use kinds

  interface fun_interface
    type(foo) function fun()
      use kinds
    end function fun
  end interface

  interface ext_fun_interface
    type(foo) function ext_fun()
      use kinds
    end function ext_fun
  end interface

  type(foo) :: x

  x = ext_fun ()
  print *, x%i

contains

  type(foo) function fun() ! { dg-error "already has an explicit interface" }
  end function fun  ! { dg-error "Expecting END PROGRAM" }

end