Title
Non-object prvalues and constant expressions
Status
cd4
Section
7.7 [expr.const]
Submitter
Faisal Vali

Created on 2015-05-20.00:00:00 last changed 95 months ago

Messages

Date: 2016-02-15.00:00:00

Proposed resolution (February, 2016):

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

A constant expression is either a glvalue core constant expression whose value refers to an entity that is a permitted result of a constant expression (as defined below), or a prvalue core constant expression whose value is an object where, for that object and its subobjects satisfies the following constraints:

  • if the value is an object of class type, each non-static data member of reference type refers to an entity that is a permitted result of a constant expression, and

  • if the object or subobject value is of pointer type, it contains the address of an object with static storage duration, the address past the end of such an object (7.6.6 [expr.add]), the address of a function, or a null pointer value., and

  • if the value is an object of class or array type, each subobject satisfies these constraints for the value.

An entity is a permitted result of a constant expression if...

Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

According to 7.7 [expr.const] paragraph 5,

A constant expression is either a glvalue core constant expression whose value... or a prvalue core constant expression whose value is an object where...

Since an integer literal is prvalue that is not an object, this definition does not allow it to be a constant expression.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2016-02-15 00:00:00adminsetmessages: + msg5699
2016-02-15 00:00:00adminsetstatus: drafting -> tentatively ready
2015-05-20 00:00:00admincreate