(j3.2006) Structure constructors that look like generic function references

Lionel, Steve steve.lionel
Tue Jun 28 05:04:29 EDT 2011


Thanks to Malcolm and Van for explaining that C496 is actually a restriction on parsing so that if the reference would be ambiguous, it is to be treated as a generic function reference and NOT a structure constructor.  It is not meant to be an error check.

Steve

From: j3-bounces at j3-fortran.org [mailto:j3-bounces at j3-fortran.org] On Behalf Of Lionel, Steve
Sent: Tuesday, June 28, 2011 10:31 AM
To: J3 at j3-fortran.org
Subject: (j3.2006) Structure constructors that look like generic function references

F2003 allows derived types and generic interfaces to have the same name (F2008 16.3.1, 440p3)  I presume that this was to allow the use of a generic function as a form of executable constructor for a derived type.  Indeed, note 4.58 (F2008 p80) says:

The form 'name(...)' is interpreted as a generic function-reference if possible; it is interpreted as a structure-
constructor only if it cannot be interpreted as a generic function-reference.

However, elsewhere on p80 is the following constraint on structure constructors:

C496 (R455) If derived-type-spec is a type name that is the same as a generic name, the component-spec-list
shall not be a valid actual-arg-spec-list for a function reference that is resolvable as a generic reference
to that name (12.5.5.2).

My reading is that this constraint outlaws the very usage note 4.58 proposes, and prevents references to any generic function if the generic shares the name of a derived type, and thus prohibits the use of a generic function as an executable constructor.

What is intended here? I think that C496 should be removed and Note 4.58 promoted to normative wording.

Steve Lionel
Developer Products Division
Software and Services Group
Intel Corporation
Merrimack, NH


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://j3-fortran.org/pipermail/j3/attachments/20110628/0321e929/attachment.html>



More information about the J3 mailing list