Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


1126.constexpr functions inconst initializers

Section:7.7  [expr.const]    Status:C++11    Submitter:GB    Date:2010-08-02

[Voted into the WP at the November, 2010 meeting.]

N3092 comment GB 25

It does not appear to be clearly enough stated that the example

    constexpr int f() { return 42 + 84; }    const int sz = f();    int a[sz];

is equivalent to

    const int sz = 42 + 84;    int a[sz];

Proposed resolution (August, 2010):

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

Certain contexts require expressions that satisfy additionalrequirements as detailed in this sub-clause; othercontexts have different semantics depending on whether ornot an expression satisfies theserequirements.Such expressionsExpressions that satisfy these requirements arecalledconstant expressions. [Note:ThoseConstant expressions can beevaluated during translation. —end note]



[8]ページ先頭

©2009-2026 Movatter.jp