aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/overload_4.f90
blob: 43207e358bae446054fc25c6406b62aece4a1ca1 (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
! { dg-do run }
! { dg-additional-options "-Wno-intrinsic-shadow" }
! PR fortran/103782 - ICE overloading an intrinsic like dble or real
! Contributed by Urban Jost

program runtest
  implicit none
  interface dble
     procedure to_double
  end interface dble
  interface real
     procedure floor ! not really FLOOR...
  end interface real
  if (any (dble ([10.0d0,20.0d0]) - [10.0d0,20.0d0] /= 0.d0)) stop 1
  if (any (real ([1.5,2.5])       - [1.5,2.5]       /= 0.0 )) stop 2
contains
  elemental function to_double (valuein) result(d_out)
    doubleprecision,intent(in) :: valuein
    doubleprecision            :: d_out
    d_out=valuein
  end function to_double
  elemental function floor (valuein) result(d_out) ! not really FLOOR...
    real, intent(in) :: valuein
    real             :: d_out
    d_out=valuein
  end function floor
end program runtest