Title
Unique objects from define_static_array
Status
open
Section
6.8.2 [intro.object]
Submitter
A. Jiang

Created on 2025-11-29.00:00:00 last changed 6 days ago

Messages

Date: 2025-12-05.22:18:07

Possible resolution:

  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 may have an address that is not unique among all other in-lifetime objects (6.8.2 [intro.object]). -- end note ]
Date: 2025-11-29.00:00:00

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.

History
Date User Action Args
2025-12-05 22:18:07adminsetmessages: + msg8432
2025-11-29 00:00:00admincreate