]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Simplify std::list assignment using 'if constexpr'
authorJonathan Wakely <jwakely@redhat.com>
Mon, 25 Nov 2024 21:57:57 +0000 (21:57 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 27 Nov 2024 12:30:00 +0000 (12:30 +0000)
commit281ac0ef1001aac1b4f4223c5dbba725a5cffb43
tree8d5295dea61f4ba66002e54133e5d376c7975e23
parent498f9aefbf36b0e3f119d634c41d86699ce6fed2
libstdc++: Simplify std::list assignment using 'if constexpr'

Use diagnostic pragmas to allow using `if constexpr` in C++11 mode, so
that we don't need to use tag dispatching.

The _M_move_assign overloads that were previously used for tag
dispatching are no longer used, but are retained here (at least for the
default config) so that an explicit instantiation will still define
those members. This ensures that old code which expects an explicit
instantiation in some other translation unit will still link. I'm not
sure if that's really needed, we should probably have a policy about
whether we support explicit instantiations where the declaration and
definition use different versions of the headers.

libstdc++-v3/ChangeLog:

* include/bits/stl_list.h (operator=(list&&)): Use if constexpr
instead of dispatching to _M_move_assign.
(_M_move_assign): Do not define for versioned namespace.
libstdc++-v3/include/bits/stl_list.h