Title
Non-static data member initializers in constant expressions
Status
c++11
Section
6.8 [basic.types]
Submitter
Jens Maurer

Created on 2010-11-13.00:00:00 last changed 130 months ago

Messages

Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010) [SUPERSEDED]:

  1. Change 6.9.3.2 [basic.start.static] paragraph 2 as follows:

    • if an object with static or thread storage duration is initialized by a constructor call, if the constructor is a constexpr constructor, if all constructor arguments are constant expressions (including conversions), and if, after function invocation substitution (9.2.6 [dcl.constexpr]), every constructor call and full-expression in the mem-initializers and in the brace-or-equal-initializers for non-static data members is a constant expression

  2. Change 6.8 [basic.types] paragraph 10 as follows (wording assumes the proposed resolution of issue 981)

  3. A type is a literal type if it is:

    • a scalar type; or

    • a class type (Clause 11 [class]) that has all of the following properties:

      • it has a trivial destructor,

      • every constructor call and full-expression in the brace-or-equal-initializers for non-static data members (if any) is a constant expression (7.7 [expr.const]),

      • it is an aggregate type (9.4.2 [dcl.init.aggr]) or has at least one constexpr constructor or constructor template that is not a copy or move constructor, and

      • it has all non-static data members and base classes of literal types; or

    • an array of literal type.

Date: 2010-11-13.00:00:00

The current treatment of constexpr constructors and constant expressions does not deal with the initializers for non-static data members, which should also be required to be constant expressions.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3303
2011-04-10 00:00:00adminsetstatus: review -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3075
2010-11-13 00:00:00admincreate