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

2026-01-10


3141. Unique objects from define_static_array

Section: 6.8.2  [intro.object]     Status: tentatively ready     Submitter: A. Jiang     Date: 2025-11-29

Subclause 6.8.2 [intro.object] bullet 9.3 specifies that any objects resulting from define_static_array are potentially overlapping (i.e. may have a non-unique address), include std::array<T, 0>.

Subclause 13.2 [temp.param] paragraph 13 (after issue 3111) specifies that template parameter objects are distinct.

Subclause 21.4.3 [meta.define.static] specifies that reflect_static_array results in a template parameter object.

These requirements appear to be contradictory. However, it was observed that "distinct object" is referring to the abstract machine notion of an object; objects can be distinct (resulting in different std::meta::info values when reflected upon) even if they have the same address.

It was further observed that only reflection facilities produce array values as template parameter objects; template arguments do not. It is design-intended that such array values can share storage with string literals and backing arrays of initializer lists.

Proposed resolution (approved by CWG 2026-01-09):

  1. Change in 6.8.2 [intro.object] bullet 9.3 as follows:

    An object is a potentially non-unique object if it is
    • a string literal object (5.13.5 [lex.string]),
    • the backing array of an initializer list (9.5.4 [dcl.init.ref]), or
    • the object introduced by a call to std::meta::reflect_constant_array or std::meta::reflect_constant_string a template parameter object of array type (21.4.3 [meta.define.static]), or
    • a subobject thereof.
  2. Change in 13.2 [temp.param] paragraph 13 as follows:

    [ Note: There can be template parameter objects of array type (21.4.3 [meta.define.static]), but such an object is never denoted by an id-expression that names a constant template parameter. Such an object can have an address that is not unique among all other in-lifetime objects (6.8.2 [intro.object]). -- end note ]