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-08
Consider:
export module M; static int x; // OK, TU-local static int &rx = x; // OK, TU-local export inline int &f() { return rx; // OK(!), not an odr-use }
The declaration of f is not an exposure because the reference to rx is not an odr-use (6.7 [basic.link] bullet 14.4), but it is impossible with current implementation technology to simulate naming x in importing translation units.
For a related example:
export module M; static int x; // OK, TU-local extern "C++" int &rx = x; // OK, not an exposure (not constexpr) export inline int &f() { return rx; // OK(!), not an odr-use }
In importing translation units, rx is not usable in constant expressions.
Finally:
export module M;
extern "C++" int x = 0;
static int &rx = x;
export constexpr inline int &f() {
return rx; // OK, not an odr-use
}
Suggested resolution:
Change in 6.3 [basic.def.odr] paragraph 5 as follows:
A variable is named by an expression if the expression is an id-expression or splice-expression (7.5.9 [expr.prim.splice]) that designates it. A variable x that is named by a potentially-evaluated expression N that appears at a point P is odr-used by N unless
- x is a reference that is usable in constant expressions at P (7.7 [expr.const]), or ...
- ...