This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1987. constexpr static data members across translation units

Section: 11.4.9.3  [class.static.data]     Status: NAD     Submitter: Richard Smith     Date: 2014-08-22

Given an example like

  struct X {
    static constexpr const char *p = "foo";
  };
  static const char *q = X::p;

if this appears in more than one translation unit, must the value of q be the same in each? The implication of the one-definition rule would be that it must be, but current implementations do not give that result.

Rationale (November, 2014):

The interpretation is correct and the implementations are incorrect.