(j3.2006) Is this prohibited?

Van Snyder Van.Snyder
Tue Jun 18 21:04:21 EDT 2013


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
    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.

If it's prohibited, is there a good reason to retain the prohibition?





More information about the J3 mailing list