Title
Inferring the bound of an array static data member
Status
cd4
Section
9.3.4.5 [dcl.array]
Submitter
Richard Smith

Created on 2015-03-15.00:00:00 last changed 95 months ago

Messages

Date: 2015-10-15.00:00:00

Proposed resolution (October, 2015):

Change 9.3.4.5 [dcl.array] paragraph 3 as follows:

...An array bound may also be omitted when the declarator is followed by an initializer (9.4 [dcl.init]) or when a declarator for a static data member is followed by a brace-or-equal-initializer (11.4 [class.mem]). In this case both cases the bound is calculated from the number of initial elements...
Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

According to 9.3.4.5 [dcl.array] paragraph 3,

An array bound may also be omitted when the declarator is followed by an initializer (9.4 [dcl.init]). In this case the bound is calculated from the number of initial elements...

However, the grammar for member-declarator uses brace-or-equal-initializer, not initializer, so the following is ill-formed:

  struct X {
    static constexpr int arr[] = { 1, 2, 3 };
  };
History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5578
2015-11-10 00:00:00adminsetstatus: drafting -> ready
2015-03-15 00:00:00admincreate