To: J3 Members J3/17-155 From: Van Snyder Subject: C856 overlooks three things, and prohibits an impossibility References: 17-007r1 Date: 2017 May 18 1. Discussion ============= C856 prohibits a variable with the PROTECTED attribute that is accessed by use association from being the in a pointer assignment statement, but it doesn't prohibit it from being the in a for a pointer component in a structure constructor, or the in a variable declaration or type definition. C856 prohibits a nonpointer object with the PROTECTED attribute from being the in a pointer assignment statement. The only objects that can be the in a pointer assignment statement are procedures and procedure pointers, but only procedure pointers can have the PROTECTED attribute. There is no nonpointer object with the PROTECTED attribute that can appear as the in a pointer assignment statement. There is no point to constrain against it. According to C854, the only nonpointer object that can have the PROTECTED attribute is a variable. C856 should more precisely say "variable" instead of "object." 2. Edits ======== [111:6-8 C856 8.5.15 PROTECTED attribute] Replace C856: "C856 A nonpointer variable that has the PROTECTED attribute and is accessed by use association shall not appear in a variable definition context (19.6.7), as the in a or in a in a , or as the in a in a in a derived type definition or in an in a type declaration statement." or "C856 A nonpointer variable that has the PROTECTED attribute and is accessed by use association shall not appear o in a variable definition context (19.6.7), o as the in a - or - in a , or o as the in - a in a in a derived type definition or - an in a type declaration statement." 3. Alternative Edits ==================== It might seem simpler to say that a nonpointer object that has the PROTECTED attribute does not have the TARGET attribute in scoping units where it is accessed by use association. That might have the bizarre indirect effect of prohibiting to use a pointer that has such a variable as its target, which could be the case if the association is established in the module where the PROTECTED attribute is specified or where the variable does not have the PROTECTED attribute, from being the in a pointer assignment statement etc., because the target of the pointer doesn't have the TARGET attribute. If it is nonetheless acceptable to say so: [111:2 8.5.15p1 PROTECTED attribute] Append a sentence: "A nonpointer variable that has the PROTECTED attribute does not have the TARGET attribute in scoping units where it is accessed by use association." [111:6 8.5.15 PROTECTED attribute] Replace "object" with "variable". [111:7-8 C856 8.5.15 PROTECTED attribute] Delete "or as the or in a ". 4. Question for the Editor ========================== Does this need to be mentioned in the Introduction? [xviii Introduction under "Data usage and computation] Insert a sentence "A nonpointer variable with the PROTECTED attribute is prohibited to appear in three contexts that were formerly allowed." 5. If this technical change is out of order at this time ======================================================== [111:6 C856 8.5.15 PROTECTED attribute] Replace "object" with "variable". [111:7 C856 8.5.15 PROTECTED attribute] Delete "or ".