This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114b. See for the official list.


1757. Const integral subobjects

Section: 7.7  [expr.const]     Status: CD4     Submitter: Richard Smith     Date: 2013-09-20

[Moved to DR at the November, 2014 meeting.]

The requirements for a constant expression in 7.7 [expr.const] permit an lvalue-to-rvalue conversion on

a non-volatile glvalue of integral or enumeration type that refers to a non-volatile const object with a preceding initialization, initialized with a constant expression

This does not exclude subobjects of objects that are not compile-time constants, for example:

  int f();
  struct S {
    S() : a(f()), b(5) {}
    int a, b;
  const S s;
  constexpr int k = s.b;

This rule is intended to provide backward compatibility with pre-constexpr C++, but it should be restricted to complete objects. Care should be taken in resolving this issue not to break the handling of string literals, since use of their elements in constant expressions depends on the current form of this rule.

Proposed resolution (February, 2014):

Change 7.7 [expr.const] bullet 2.7 as follows:

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: