[J3] please try running this program
rpcorbett at att.net
Mon Oct 24 15:14:11 UTC 2022
The RETURN statement should be removed and the type of the component Y should be REAL.
Because there are no special scoping rules for implicit declarations in type definitions in Fortran 2018, the usual scoping rules for local identifiers apply. In Fortran 2018 and in draft Fortran 2023, the scope of the variable X in the type definition is the type definition.
I authored the original version of F03/123.
My suggested fix was to ban implicit declarations in type definitions, but no one supported that idea. Even I did not vote for it in plenary, because Oracle’s Fortran team wanted the fix that was eventually adopted in Fortran 2008. There was one vote in favor of banning implicit declarations when Oracle’s Fortran team voted on the matter.
> On Oct 24, 2022, at 6:39 AM, Steve Lionel via J3 <j3 at mailman.j3-fortran.org> wrote:
>> On 10/24/2022 8:20 AM, Robert Corbett via J3 wrote:
>> INTEGER(KIND(X)) Y
> Aside from the scoping question, this declaration improperly assumes that one can declare an integer using the kind number of a real. If you had used REAL instead of INTEGER it would have been fine.
> On Bob's question, I see that the wording change in F08 Corrigendum 1 came from interp F03/123, which contains a similar example. The original paper for this edit was 10-244. I haven't yet found a paper that removes the wording added in that paper, but I see that F18's version is simpler and does not attempt to state the scope in which the variable is declared.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3