(Motivated but independent from http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/817234ccd2b3ae1b#) The following program is rejected in gfortran until one adds a component. I agree that it is not particularly useful but I think it is standard conform. In any case the error message is bogus: type(t) function foo() 1 Error: The type for function 'foo' at (1) is not accessible module m type t end type t end module type(t) function foo() use m foo = t() end function foo
The test is also rejected by g95 and ifort, the latter gives: error #7128: A derived-type-def must have at least one component-def-stmt.
(In reply to comment #1) > The test is also rejected by g95 and ifort, the latter gives: > error #7128: A derived-type-def must have at least one component-def-stmt. I did not claim that I have a valid Fortran 95 program - in Fortran 2003 it is allowed. And ifort 11.1 compiles it (well, at least without the empty structure constructor which gives a "not yet implemented" error.).
Subject: Bug 41369 Author: dfranke Date: Thu Dec 10 21:03:40 2009 New Revision: 155141 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155141 Log: 2009-12-10 Daniel Franke <franke.daniel@gmail.com> PR fortran/41369 * parse.c (match_deferred_characteristics): Removed check for empty types in function return values. 2009-12-10 Daniel Franke <franke.daniel@gmail.com> PR fortran/41369 * gfortran.dg/func_derived_5.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/func_derived_5.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/parse.c trunk/gcc/testsuite/ChangeLog
Fixed in trunk. Closing.