Movatterモバイル変換


[0]ホーム

URL:


Issue 2418 - WG21 CWG Issues
Title
Missing cases in definition of “usable in constant expressions”
Status
cd5
Section
7.7 [expr.const]
Submitter
Richard Smith

Created on2018-11-25.00:00:00 last changed62 months ago

Messages

msg6392 (view)
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 itsinitializing declaration is encountered if it is a constexprvariable, or it is of reference type or of const-qualifiedintegral or enumeration type, and its initializer is aconstant initializer.An object or reference isusable in constant expressions if it is

  • a variable that is usable in constantexpressions, 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 memberof any of the above, or

  • a complete temporary object of non-volatileconst-qualified integral or enumeration type that isinitialized with a constant expression.

msg6391 (view)
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 forvariables:

A variable isusable in constant expressions afterits initializing declaration is encountered if it is aconstexpr variable, or it is of reference type or ofconst-qualified integral or enumeration type, and itsinitializer is a constant initializer.

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

History
DateUserActionArgs
2020-12-15 00:00:00adminsetmessages: +msg6392
2018-11-25 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp