OSDN Git Service

ChangeLogs fixed, again.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / userdef_operator_1.f90
1 ! { dg-do compile }
2 ! Testcase from PR 25396: User defined operators returning arrays.
3 module geometry
4
5   implicit none
6
7   interface operator(.cross.)
8      module procedure cross
9   end interface
10
11 contains
12
13     ! Cross product between two 3d vectors.
14     pure function cross(a, b)
15       real, dimension(3), intent(in) :: a,b
16       real, dimension(3) :: cross
17
18      cross = (/ a(2) * b(3) - a(3) * b(2), &
19            a(3) * b(1) - a(1) * b(3), &
20            a(1) * b(2) - a(2) * b(1) /)
21     end function cross
22
23 end module geometry
24
25 program opshape
26   use geometry
27
28   implicit none
29
30   real :: t(3,3), a
31
32   a = dot_product (t(:,1), t(:,2) .cross. t(:,3))
33
34 end program opshape
35
36 ! { dg-final { cleanup-modules "geometry" } }