# Constant conditional expressions?

Does F2023 allow a conditional expression to be used where a constant expression is needed, e.g.

integer,parameter:: a = ( b > c & d : e )

where b,c,d,e are all scalar constants?

MERGE is an elemental standard intrinsic function, and > is intrinsic operation, so

Integer, Parameter :: a = MERGE(d,e,b>c)

satisfies the conditions for 10.1.12 Constant expression.
None of the conditions listed mention conditional expressions, which is one form of a primary, from which I conclude that your line is not admissible.

I believe it qualifies based on the following:

10.1.2.3 Conditional expressions
A conditional expression is a primary …

10.1.4 Evaluation of operations

Evaluation of a conditional-expr evaluates each scalar-logical-expr in order, until the value of a scalar-logical-expr is true, or there are no more scalar-logical-exprs. If the value of a scalar-logical-expr is true, its subsequent expr is chosen; otherwise, the last expr of the conditional-expr is chosen. The chosen expr is evaluated, and its value is the value of the conditional expression.

10.1.12 Constant expression
A constant expression is an expression … in which … each primary is
(1) a constant or subobject of a constant,

(15) a constant expression enclosed in parentheses

So my reading suggests that if the logical expressions and the chosen expression are all constant expressions, then the conditional expression is a constant expression.

The “a constant expression enclosed in parentheses” formulation also appears in F2018 which did not have conditional expressions. Also, the distinct “( expr )” and “conditional-expr” forms in R1001 suggest that the formulation “a constant expression enclosed in parentheses” does not include conditional expressions.