Title
Missing cases in definition of “usable in constant expressions”
Status
cd5
Section
7.7 [expr.const]
Submitter
Richard Smith

Created on 2018-11-25.00:00:00 last changed 40 months ago

Messages

Date: 2020-12-15.00:00:00

Proposed resolution, June, 2019:

Change 7.7 [expr.const] paragraph 3 as follows:

A variable is usable in constant expressions after its initializing declaration is encountered if it is a constexpr variable, or it is of reference type or of const-qualified integral or enumeration type, and its initializer is a constant initializer. An object or reference is usable in constant expressions if it is

  • a variable that is usable in constant expressions, or

  • a template parameter object (13.2 [temp.param]), or

  • a string literal object (5.13.5 [lex.string]), or

  • a non-mutable subobject or reference member of any of the above, or

  • a complete temporary object of non-volatile const-qualified integral or enumeration type that is initialized with a constant expression.

Date: 2019-07-15.00:00:00

[Accepted as a DR at the July, 2019 meeting.]

The term “usable in constant expressions” (7.7 [expr.const] paragraph 3) is only defined for variables:

A variable is usable in constant expressions after its initializing declaration is encountered if it is a constexpr variable, or it is of reference type or of const-qualified integral or enumeration type, and its initializer is a constant initializer.

However, uses of the term assume that it applies more widely. For example, 7.7 [expr.const] bullet 4.7.1 mentions “a non-volatile glvalue that refers to an object that is usable in constant expressions” (not all objects are variables), and bullet 4.10.1 speaks of a “data member of reference type” (also not a variable) that is usable in constant expressions.

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6392
2018-11-25 00:00:00admincreate