summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/use_7.f90
blob: 7ebd1e2bf2c3fa7b7ccf03228551441b11d70c27 (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
45
46
47
48
49
! { dg-do compile }
! Renaming of operators
module z
  type myT
    integer :: t
  end type myT
  interface operator(+)
    module procedure sub2
  end interface
contains
function sub2(x)
  type(myT) :: sub2
  type(myT),intent(in) :: x
  sub2%t = x%t + 5
end function sub2
end module z

module y
  interface operator(.addfive.)
    module procedure sub
  end interface
contains
function sub(x)
  integer :: sub
  integer,intent(in) :: x
  sub = x + 15
end function sub
end module y

module x
  interface operator(.addfive.)
    module procedure sub
  end interface
contains
function sub(x)
  integer :: sub
  integer,intent(in) :: x
  sub = x + 25
end function sub
end module x

use z, operator(-) => operator(+) ! { dg-error "Syntax error in USE statement" }
use z, operator(.op.) => operator(+) ! { dg-error "Syntax error in USE statement" }
use x, only : bar => operator(.addfive.) ! { dg-error "Syntax error in USE statement" }
use y, operator(.my.) => sub ! { dg-error "Syntax error in USE statement" }
use y, operator(+) => operator(.addfive.) ! { dg-error "Syntax error in USE statement" }
end

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