Created on 2026-01-07.00:00:00 last changed 5 days ago
Proposed resolution:
This wording is relative to N5032.
Modify [const.wrap.class], class template `constant_wrapper` synopsis, as indicated:
struct cw-operators { // exposition only
…
// pseudo-mutators
template<constexpr-param T>
constexpr auto operator++(this T) noexcept
-> constant_wrapper<++Y (++T::value)> { return {}; }
template<constexpr-param T>
constexpr auto operator++(this T, int) noexcept
-> constant_wrapper<Y++ (T::value++)> { return {}; }
template<constexpr-param T>
constexpr auto operator--(this T) noexcept
-> constant_wrapper<--Y (--T::value)> { return {}; }
template<constexpr-param T>
constexpr auto operator--(this T, int) noexcept
-> constant_wrapper<Y-- (T::value--)> { return {}; }
…
};
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<(X = R::value)> { return {}; }
constexpr operator decltype(auto)() const noexcept { return value; }
};
[ 2026-01-16; Reflector poll. ]
Set status to Tentatively Ready after five votes in favour during reflector poll.
During resolution of LWG 4383 prefix and postfix increment and decrement operators were changed to
template<constexpr-param T>
constexpr auto operator++(this T) noexcept -> constant_wrapper<++Y>
{ return {}; }
template<constexpr-param T>
constexpr auto operator++(this T, int) noexcept ->
constant_wrapper<Y++> { return {}; }
template<constexpr-param T>
constexpr auto operator--(this T) noexcept -> constant_wrapper<--Y>
{ return {}; }
template<constexpr-param T>
constexpr auto operator--(this T, int) noexcept ->
constant_wrapper<Y--> { return {}; }
However, we do not actually specify what `Y` is. Additionally, the assignment operator has been changed to
template<constexpr-param R>
constexpr auto operator=(R) const noexcept
-> constant_wrapper<X = R::value> { return {}; }
This is grammatically not valid C++. The assignment must be parenthesized.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-01-16 22:12:42 | admin | set | messages: + msg15872 |
| 2026-01-16 22:12:42 | admin | set | status: new -> ready |
| 2026-01-07 09:22:52 | admin | set | messages: + msg15846 |
| 2026-01-07 00:00:00 | admin | create | |