This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
constant_wrapper should assign to valueSection: 21.3.5 [const.wrap.class] Status: New Submitter: Tomasz KamiĆski Opened: 2026-02-17 Last modified: 2026-02-17
Priority: Not Prioritized
View other active issues in [const.wrap.class].
View all other issues in [const.wrap.class].
View all issues with New status.
Discussion:
During resolution of LWG 4383(i) assignment operator of constant_wrapper,
was changed to:
template<constexpr-param R>
constexpr auto operator=(R) const noexcept -> constant_wrapper<X = R::value> { return {}; }
This is incorrect (and inconsistent with other operators), as we assign to
X that is object of specialization of exposition only cw-fixed-value,
instead of value.
Proposed resolution:
This wording is relative to N5032 with changes from 4500(i).
Modify 21.3.5 [const.wrap.class],
class template constant_wrapper synopsis, as indicated:
template<cw-fixed-value X, class>
struct constant_wrapper : cw-operators {
static constexpr const auto & value = X.data;
using type = constant_wrapper;
using value_type = decltype(X)::type;
template<constexpr-param R>
constexpr auto operator=(R) const noexcept
-> constant_wrapper<(valueX = R::value)> { return {}; }
constexpr operator decltype(auto)() const noexcept { return value; }
};