(j3.2006) Still illegal in F08?

Van Snyder vsnyder
Tue Jan 5 16:26:27 EST 2010

The following declaration of B is not legal in F2003:

  subroutine S ( A )
    real, optional :: A(:)
    real :: B(merge(size(a),0,present(A))
  end subroutine S

because "present" is not one of the specification inquiry functions
listed starting at 04-007:125:37.

Even though we expanded the list of inquiry functions to include them
all, it seems that this is still illegal in F2008 because A is optional
and therefore not a restricted expression, and "present" doesn't return
an integer result and therefore the "present(A)" argument of "merge"
isn't a restricted expression.  Item (9)(b)(3) in 7.1.11p2 on page 150
in 09-007r3 appears to be the killer.

Did we intend to allow or to prohibit this?

If we wanted to allow it, I think we would need to replace (9)(a) with
  (a) a restricted expression,
  (a') a reference to the PRESENT intrinsic function, or


More information about the J3 mailing list