To: J3 J3/24-101 From: Steve Lionel Subject: F2023 interp: BOZ literals in interoperable enumerators Date: 2023-December-18 ---------------------------------------------------------------------- NUMBER: F23/013 TITLE: BOZ literals in interoperable enumerators KEYWORDS: BOZ, enumerators DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: For Fortran 2023, work item US-23 expanded the contexts in which BOZ constants were allowed, to include "as the for a named constant of type INTEGER or REAL,..." (C7119). 19-256r1 had the primary edits, with 21-101 containing additional edits not relevant to this paper. 19-256r1 contained examples showing use of BOZ constants in PARAMETER statements, but did not mention interoperable enumerators, which are "named integer constant[s]" (7.6.1p1). Consider the following: ENUMERATOR :: FOO = Z'123' is this conforming in Fortran 2023? Clearly, the intent of US-23 was that it should be, but the syntax rule for is: R762 enumerator is named-constant [ = scalar-int-constant-expr ] Since a BOZ constant has no type (7.7p1), it can't be an integer, and thus isn't a scalar-int-constant-expr. Was this exclusion intended? (Note: PARAMETER does not have this issue.) ANSWER: No - it was intended to allow BOZ constants as the value for interoperable enumerators just as they are in the PARAMETER statement. Edits to correct this are provided. EDITS to 24-007: [7.6.1, 95:18+ Interoperable enumerations and enum types] insert after: R762 enumerator is named-constant [ = scalar-int-constant-expr ] " or [ = ]" (The Editor is welcome to substitute an alternate expression of this definition, such as creating a new term for the initializer.) [7.6.1p6, 96:5-9 Interoperable enumerations and enum types] In the numbered list following "The enumerator is a scalar named constant, with the value determined as follows.", make the following changes. Insert after (1): "(1a) if boz-literal-constant appears, the enumerator has the value specified by INT(boz-literal-constant, C_INT), where C_INT is from the intrinsic module ISO_C_BINDING." In the current (2) and (3), replace "If scalar-int-constant-expr does not appear" with "If neither scalar-int-constant-expr nor boz-literal-constant appears" such that the new list items read: (2a) If neither scalar-int-constant-expr nor boz-literal-constant appears and the enumerator is the first enumerator in enum-def, the enumerator has the value zero. (3a) If neither scalar-int-constant-expr nor boz-literal-constant appears and the enumerator is not the first enumerator in enum-def, it has the value obtained by adding one to the value of the enumerator that immediately precedes it in the enum-def. SUBMITTED BY: Steve Lionel HISTORY: 24-101 m232 F23/013 submitted ----------------------------------------------------------------------