(j3.2006) Is this prohibited? (with obvious blunder repaired)
Robert Corbett
robert.corbett
Wed Jun 19 20:48:42 EDT 2013
On 06/18/13 18:08, Van Snyder wrote:
> On Tue, 2013-06-18 at 18:04 -0700, Van Snyder wrote:
>> It's not obvious that this is prohibited, but nobody seems to like it:
>>
>> module M
>>
>> contains
>>
>> function F ( A )
>> integer, intent(in), optional :: A
>> integer :: F(merge(2,3,present(a))) !<--- This is where the objections occur
> integer :: F(merge(3,2,present(a))) !<--- Repair obvious blunder !!!
>> if ( present(a)) then
>> f = (/ 1, 2, a /)
>> else
>> f = (/ 1, 2 /)
>> end if
>> end function F
>>
>> end module M
>>
>> It seems that 7.1.11p2(9)(b) together with 7.1.11p4(1) allow it.
>>
>>
I agree with Van.
The function reference present(a) satisfies item (9) of the list in 7.1.11
paragraph 2. The only subitem that might be an issue is subitem (9)(b)(iii).
However, the property inquired about in the case of PRESENT, namely the presence
of the argument, is not "defined by an expression" and therefore is not "defined
by an expression that is not a restricted expression."
Bob Corbett
More information about the J3
mailing list