We already added it to the std::vector primary template.
* include/bits/stl_bvector.h (vector<bool>::empty()): Add nodiscard attribute. Tested powerpc64le-linux, committed to trunk.
commit 42dd15d09edbdafbeb068b9b2191e459b9df1b82 Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Apr 29 13:23:54 2019 +0100 Add nodiscard to std::vector<bool>::empty() We already added it to the std::vector primary template. * include/bits/stl_bvector.h (vector<bool>::empty()): Add nodiscard attribute. diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 294f1e42897..c60f4f0ef1c 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -878,7 +878,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return size_type(const_iterator(this->_M_impl._M_end_addr(), 0) - begin()); } - bool + _GLIBCXX_NODISCARD bool empty() const _GLIBCXX_NOEXCEPT { return begin() == end(); }