$ cat bug3.f90 module mod1 type my_type integer i end type my_type end module mod1 module mod2 use mod1, only: mod1_type => my_type interface function my_func1() import mod1_type type(mod1_type) :: my_func1 end function my_func1 type(mod1_type) function my_func2() import mod1_type end function my_func2 end interface end module mod2
$ /usr/local/gfortran/bin/gfortran -c bug3.f90 | & more bug3.f90:13.4: type(mod1_type) function my_func2() 1 Error: The type for function 'my_func2' at (1) is not accessible This only happens for a USE-renamed derived-type, when the function return is a derived type declared in the specification expression, as in my_func2. If the mod1 type is used without renaming, both forms are accepted. This may be related to bug41370, which is about a similar issue for character length expressions in the return type. -- Summary: Function return-type declaration with specification expression rejected for renamed derived types Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jkrahn at nc dot rr dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44830