This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


1952. Constant expressions and library undefined behavior

Section: 7.7  [expr.const]     Status: CD4     Submitter: Daniel Krügler     Date: 2014-06-22

[Moved to DR at the May, 2015 meeting.]

According to bullet 2.5 of 7.7 [expr.const],

A conditional-expression e is a core constant expression unless the evaluation of e, following the rules of the abstract machine (6.9.1 [intro.execution]), would evaluate one of the following expressions:

The definition of “operation” is unclear. In particular, is it intended to include use of library components that are specified to produce undefined behavior, such as use of the offsetof macro when applied to a non-standard-layout class?

Proposed resolution (April, 2015):

  1. Change 7.7 [expr.const] bullet 2.5 as follows:

  2. Add the following at the end of 7.7 [expr.const] paragraph 2:

  3. If e satisfies the constraints of a core constant expression, but evaluation of e would evaluate an operation that has undefined behavior as specified in Clauses Clause 16 [library] through Clause 33 [thread] of this International Standard, it is unspecified whether e is a core constant expression.