This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
is_steady of a Cpp17Clock type required to be usable in constant expressions?Section: 30.3 [time.clock.req] Status: New Submitter: Jiang An Opened: 2025-11-26 Last modified: 2025-12-19
Priority: Not Prioritized
View all other issues in [time.clock.req].
View all issues with New status.
Discussion:
In 30.3 [time.clock.req]/[tab:time.clock], the static data member C1::is_steady seemingly
indicates the property of the clock statically, as the requirements say "always".
C1::steady should be usable in a constant expression. A hostile
reading may indicate that it is allowed to make C1::steady only defined in some separated translated
unit and/or initialized from some non-constant expression.
Also, it is not very clear that the "always" means the conditions always hold in all executions,
or only always hold in the current execution. The latter reading allows C1::steady to vary between
executions.
Proposed resolution:
This wording is relative to N5032.
[Drafting Note: Two mutually exclusive options are prepared, depicted below by Option A and Option B, respectively.]
Option A: Requiring usability in constant expressions.
Modify Table [tab:time.clock] — Cpp17Clock requirements as indicated:
Table 131 — Cpp17Clock requirements [tab:time.clock] Expression Return type Operational semantics […]C1::is_steadyconst booltrueift1 <= t2is alwaystrueand the time between
clock ticks is constant,
otherwisefalse.
C1::is_steadyshall be usable in constant expressions (7.7 [expr.const]).[…]
Option B: Allowing varying between executions.
Modify Table [tab:time.clock] — Cpp17Clock requirements as indicated:
Table 131 — Cpp17Clock requirements [tab:time.clock] Expression Return type Operational semantics […]C1::is_steadyconst booltrueift1 <= t2is alwaystrueand the time between
clock ticks is constant
for the duration of the current program execution,
otherwisefalse.
[Note ?:C1::is_steadyis not required to be usable in constant expressions (7.7 [expr.const]) and can vary between different executions. — end note][…]