Title
Use of address constants in constant expressions
Status
nad
Section
7.7 [expr.const]
Submitter
Bjarne Stroustrup

Created on 2012-08-16.00:00:00 last changed 146 months ago

Messages

Date: 2012-10-15.00:00:00

Rationale (October, 2012):

CWG was comfortable with this implication of the current wording.

Date: 2022-11-20.07:54:16

It appears that the current specification of constant expressions in 7.7 [expr.const] pararaph 2 permits examples like

  constexpr const char* p = "asdf";
  constexpr char ch = p[2];

This seems unnecessarily complicated for both users and implementers. If subscripting were defined directly, rather than in terms of pointer arithmetic and indirection (see issue 1213), we could still support the obvious cases of things like

  constexpr char ch2 = "asdf"[2];

without requiring compilers and users to track the target of address-constant pointers and references.

History
Date User Action Args
2012-11-03 00:00:00adminsetmessages: + msg4175
2012-11-03 00:00:00adminsetstatus: open -> nad
2012-08-16 00:00:00admincreate