2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / use_4.f90
blobb7249b0f0d6974b524fb65f99075ec032f3a6a24
1 ! { dg-do compile }
2 ! PR fortran/30973
3 ! Using symbols with the name of the module
5 module foo
6 integer :: i
7 end module foo
9 module bar
10 integer :: j
11 end module bar
13 module test
14 use foo, only:
15 integer :: foo ! { dg-error "cannot have a type" }
16 end module test
18 module test2
19 use bar, only: foo => j
20 use foo ! ok, unless foo is accessed
21 end module test2
23 module test3
24 use bar, only: foo => j
25 use foo ! ok, unless foo is accessed
26 foo = 5 ! { dg-error "is an ambiguous reference to 'j'" }
27 end module test3
29 program test_foo
30 use foo, only: foo ! { dg-error "been used as an external module name" }
31 use foo, only: i => foo! { dg-error "been used as an external module name" }
32 use foo, only: foo => i! { dg-error "been used as an external module name" }
33 end program
34 ! { dg-final { cleanup-modules "foo bar test test2 test3" } }