The following program from http://groups.google.com/group/comp.lang.fortran/msg/38bbc52c641f4b13 is rejected with: TYPE(T), PARAMETER :: C = T(X) !!! 1 Error: Parameter 'x' at (1) has not been declared or is a variable, which does not reduce to a constant expression The check is wrong as one has a pointer initialization - and X is a valid REAL, TARGET, SAVE variable. Without PARAMETER, the initialization works. I think just the checking needs to be fixed. (Note this is a F2008 feature.) Variant: Use "T()" an in the derived type "P => X". PROGRAM MAIN TARGET X DATA X/0.0/ TYPE T REAL, POINTER :: P END TYPE TYPE(T), PARAMETER :: C = T(X) !!! READ *, X CALL SUBR() CONTAINS SUBROUTINE SUBR REAL, PARAMETER :: Y = C%P !!! PRINT *, Y END SUBROUTINE END
Hmm, I somehow have the feeling that encountered this bug already. See the thread starting at http://j3-fortran.org/pipermail/j3/2011-November/004840.html I think I concur with Malcolm that the code of comment 0 cannot be implemented (at least not without combining the linker with the front-end compiler, something no one wants to do): http://j3-fortran.org/pipermail/j3/2011-November/004851.html On the other hand, I think Bob right at http://j3-fortran.org/pipermail/j3/2011-November/004857.html that the current standard seems to have a loop hole. I probably should have realized the discussion earlier - on the other hand, Bob seems to insist (cf. link above) that the program is not only valid but should also be valid - otherwise, I presume, he wouldn't have posted it at comp.lang.fortran. (A PR might already exist for this thread.)
(In reply to comment #1) > (A PR might already exist for this thread.) Well, there is PR 45290 and PR 50410 comment 9, which are at least related.
(In reply to comment #2) > > (A PR might already exist for this thread.) > > Well, there is PR 45290 and PR 50410 comment 9, which are at least related. And moreover there is PR 51076, which is really identical to this one.
*** Bug 51076 has been marked as a duplicate of this bug. ***
The links to http://j3-fortran.org/pipermail/j3/* are dead!-(
> The links to http://j3-fortran.org/pipermail/j3/* are dead!-( Updated links http://mailman.j3-fortran.org/pipermail/j3/2011-November/004840.html http://mailman.j3-fortran.org/pipermail/j3/2011-November/004851.html http://mailman.j3-fortran.org/pipermail/j3/2011-November/004857.html