Created on 2026-08-15.00:00:00 last changed 6 days ago
Possible resolution:
Change in 6.9.2 [basic.types.trivial] paragraph 1 as follows:
Each trivially copyable type T has an implementation-defined set of discrete values. Each possible value representation of an object of type T corresponds to a distinct implementation-defined subset of this set. The union of these subsets is the set of values; for scalar types other than object pointer and pointer-to-member types, each such subset contains no more than one value. Certain operations cause an object to acquire a value representation, in which case the object's value is replaced with an unspecified member of the corresponding subset that would result in the program having defined behavior, if any.
Consider:
union U { int x, y; };
template <auto> int q;
int main(void) {
unsigned long x = __builtin_bit_cast(unsigned long, &U::x);
unsigned long y = __builtin_bit_cast(unsigned long, &U::y);
assert(x == y);
assert(&q<&U::x> != &q<&U::y>);
}
Two pointer-to-member values may reasonably have the same value representations, yet their (abstract) values can be different. P2434R5 (Nondeterministic Pointer Provenance) introduced a regression here.
The angelic non-determinism imbued by "acquire a value representation" is well-motivated for pointer values, but has less motivation for pointer-to-member values. For example, an access using a pointer-to-member of base type pointing to a member of derived class A could be identified, by an implementation through the use of metadata, as disjoint from an access to a member of a different derived class B (where neither A nor B is a base of the other). The requirement for angelic non-determinism would necessitate changes in how the metadata is maintained or used. It is known, however, that similar metadata is used in the object pointer case, so any implementation burden of the new change is not substantially higher.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-08-15 06:36:26 | admin | set | messages: + msg8644 |
| 2026-08-15 00:00:00 | admin | create | |