PR c++/27177
[official-gcc.git] / gcc / testsuite / gfortran.dg / operator_5.f90
blob6ce77c8dc4dde845b7d4796c60e685abd211e6a1
1 ! { dg-do compile }
2 ! { dg-options "-c" }
4 MODULE mod_t
5 type :: t
6 integer :: x
7 end type
9 ! user defined operator
10 INTERFACE OPERATOR(.FOO.)
11 MODULE PROCEDURE t_foo
12 END INTERFACE
14 INTERFACE OPERATOR(.FOO.)
15 MODULE PROCEDURE t_foo ! { dg-error "already present" }
16 END INTERFACE
18 INTERFACE OPERATOR(.FOO.)
19 MODULE PROCEDURE t_bar ! { dg-error "Ambiguous interfaces" }
20 END INTERFACE
22 ! intrinsic operator
23 INTERFACE OPERATOR(==)
24 MODULE PROCEDURE t_foo
25 END INTERFACE
27 INTERFACE OPERATOR(.eq.)
28 MODULE PROCEDURE t_foo ! { dg-error "already present" }
29 END INTERFACE
31 INTERFACE OPERATOR(==)
32 MODULE PROCEDURE t_bar ! { dg-error "Ambiguous interfaces" }
33 END INTERFACE
35 INTERFACE OPERATOR(.eq.)
36 MODULE PROCEDURE t_bar ! { dg-error "already present" }
37 END INTERFACE
39 CONTAINS
40 LOGICAL FUNCTION t_foo(this, other)
41 TYPE(t), INTENT(in) :: this, other
42 t_foo = .FALSE.
43 END FUNCTION
45 LOGICAL FUNCTION t_bar(this, other)
46 TYPE(t), INTENT(in) :: this, other
47 t_bar = .FALSE.
48 END FUNCTION
49 END MODULE
51 ! { dg-final { cleanup-modules "mod_t" } }