Tomasz Kaminski [Wednesday, 18 February 2026 11:50:09 CET]: > On Wed, Feb 18, 2026 at 11:40 AM Matthias Kretz <[email protected]> > > wrote: > > Tomasz Kamiński [Wednesday, 18 February 2026 11:01:14 CET]: > > > This implements LWG4383 with LWG4500, LWG4523 follow-up corrections. > > > > > > This patch changes the constant_wrapper assignments operator (including > > > compounds), increment and decrement to apply directly to value. In > > > consequence the operators are only supported for types, for which above > > > operations can be applied on const value. > > > > > > libstdc++-v3/ChangeLog: > > > * include/std/type_traits (_CWOperators::operator++) > > > (_CWOperators::operator--, _CWOperators::operator+=) > > > (_CWOperators::operator-=, _CWOperators::operator*=) > > > (_CWOperators::operator/=, _CWOperators::operator%=) > > > (_CWOperators::operator&=, _CWOperators::operator|=) > > > (_CWOperators::operator^=, _CWOperators::operator<<=) > > > (_CWOperators::operator>>=, constant_wrapper::operator=): > > > Adjust definitions to apply operator on value. > > > * testsuite/20_util/constant_wrapper/generic.cc: > > > Remove test_pseudo_mutator. > > > * testsuite/20_util/constant_wrapper/instantiate.cc: > > > Test that operators are not provided if wrapped type > > > do not support them, or provide mutable operators. > > > > > > --- > > > Tested on x86_64-linux. OK for trunk? > > > > > > libstdc++-v3/include/std/type_traits | 110 ++--- > > > .../20_util/constant_wrapper/generic.cc | 14 - > > > .../20_util/constant_wrapper/instantiate.cc | 441 ++++++++++++------ > > > 3 files changed, 323 insertions(+), 242 deletions(-) > > > > > > diff --git a/libstdc++-v3/include/std/type_traits > > > b/libstdc++-v3/include/std/type_traits index ea700d1ed97..2fe3b48a938 > > > 100644 > > > --- a/libstdc++-v3/include/std/type_traits > > > +++ b/libstdc++-v3/include/std/type_traits > > > @@ -4593,9 +4593,8 @@ template<typename _Ret, typename _Fn, typename... > > > _Args> template<_ConstExprParam _Tp, _ConstExprParam... _Args> > > > > > > constexpr auto > > > operator()(this _Tp, _Args...) noexcept > > > > > > - requires > > > - requires(_Args...) { > > > > constant_wrapper<_Tp::value(_Args::value...)>(); > > } > > > > > - { return constant_wrapper<_Tp::value(_Args::value...)>{}; } > > > + -> constant_wrapper<(_Tp::value(_Args::value...))> > > > + { return {}; } > > > > > > template<_ConstExprParam _Tp, _ConstExprParam... _Args> > > > > > > constexpr auto > > > > > > @@ -4606,128 +4605,86 @@ template<typename _Ret, typename _Fn, > > > > typename... > > > > > _Args> template<_ConstExprParam _Tp> > > > > Why are you changing operator()? I see no Changelog entry for it. And as > > far > > as I understand, this change makes it IFNDR for arithmetic types. > > I did this as a pure accident, assuming that I mechanically went through > every declaration > that does not follow a pattern and changed it. Will rever that. > > Why is IFNDR for arithmetic types? I do see anything that would make it > that.
[temp.res.general] p6:
The validity of a templated entity may be checked prior to any instantiation.
The program is ill-formed, no diagnostic required, if
(6.1) no valid specialization […] can be generated for a templated entity
or a substatement of a constexpr if statement ([stmt.if]) within a templated
entity and the innermost enclosing template is not instantiated, or
Since _Tp::value is e.g. an 'int' object and 1(whatever) cannot ever be valid
("no valid specialization can be generated"). Apparently Clang in some
circumstances fails/failed on this.
This is different for 1[whatever]. This can be valid. 🙈
This issue was reported to Zach and me by Chromo Runge.
- Matthias
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Center for Heavy Ion Research https://gsi.de
std::simd
──────────────────────────────────────────────────────────────────────────
signature.asc
Description: This is a digitally signed message part.
