aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/c_global
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-04-06 14:41:29 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-04-06 16:43:25 +0100
commit406f58e1e38e92e4b881f3666b596843da308783 (patch)
tree51ed49f19e399a73512f6b843bebe0388b0503a1 /libstdc++-v3/include/c_global
parent41019bfae2673a818a9b7d08742f3ef91c0deade (diff)
downloadgcc-406f58e1e38e92e4b881f3666b596843da308783.zip
gcc-406f58e1e38e92e4b881f3666b596843da308783.tar.gz
gcc-406f58e1e38e92e4b881f3666b596843da308783.tar.bz2
libstdc++: Add nodiscard attribute to cast-like functions
Add [[nodiscard]] to functions that are effectively just a static_cast, as per P2351. Also add it to std::addressof. libstdc++-v3/ChangeLog: * include/bits/move.h (forward, move, move_if_noexcept) (addressof): Add _GLIBCXX_NODISCARD. * include/bits/ranges_cmp.h (identity::operator()): Add nodiscard attribute. * include/c_global/cstddef (to_integer): Likewise. * include/std/bit (bit_cast): Likewise. * include/std/utility (as_const, to_underlying): Likewise.
Diffstat (limited to 'libstdc++-v3/include/c_global')
-rw-r--r--libstdc++-v3/include/c_global/cstddef1
1 files changed, 1 insertions, 0 deletions
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index 11c808c..13ef7f0 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -169,6 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __l = __l ^ __r; }
template<typename _IntegerType>
+ [[nodiscard]]
constexpr _IntegerType
to_integer(__byte_op_t<_IntegerType> __b) noexcept
{ return _IntegerType(__b); }