Title
constexpr functions in const initializers
Status
c++11
Section
7.7 [expr.const]
Submitter
GB

Created on 2010-08-02.00:00:00 last changed 130 months ago

Messages

Date: 2010-11-15.00:00:00

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

Date: 2010-08-15.00:00:00

Proposed resolution (August, 2010):

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

Certain contexts require expressions that satisfy additional requirements as detailed in this sub-clause; other contexts have different semantics depending on whether or not an expression satisfies these requirements. Such expressions Expressions that satisfy these requirements are called constant expressions. [Note: Those Constant expressions can be evaluated during translation. —end note]
Date: 2010-08-02.00:00:00
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];
History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: dr -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3161
2010-11-29 00:00:00adminsetstatus: ready -> dr
2010-08-23 00:00:00adminsetmessages: + msg2770
2010-08-02 00:00:00admincreate