[Bug fortran/37274] [Regression 4.4 (and 4.3?)] error: type name is ambiguous.

mikael dot morin at tele2 dot fr gcc-bugzilla@gcc.gnu.org
Sat Aug 30 11:28:00 GMT 2008



------- Comment #7 from mikael dot morin at tele2 dot fr  2008-08-30 11:27 -------
I think this should be rejected :

module class_vector
  implicit none
  type vector
  end type vector
end module class_vector

module tools_math
  implicit none
  interface lin_interp
     function lin_interp_v()
       use class_vector
       type(vector ) :: lin_interp_v
     end function lin_interp_v
  end interface
end module tools_math

module smooth_mesh
  use tools_math    
  implicit none
  type(vector ) :: new_pos  ! vector shouldn't be available IMHO 
end module smooth_mesh

I find this behavior very confusing, inconsistent with the concept of scoping 
units. 
While I understand that vector should make its way to the tools_math.mod file
for lin_interp_v's type checking, it should be kept local to that function. 
I haven't seen it explicitely in the standard though. 

Salvatore, as a workaround you can put a private statement in modules
where you "use module" from within a function. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37274



More information about the Gcc-bugs mailing list