File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -235,9 +235,9 @@ public:
235235# endif
236236
237237 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty () const { return c.empty (); }
238- _LIBCPP_HIDE_FROM_ABI size_type size () const { return c.size (); }
239- _LIBCPP_HIDE_FROM_ABI reference top () { return c.back (); }
240- _LIBCPP_HIDE_FROM_ABI const_reference top () const { return c.back (); }
238+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size () const { return c.size (); }
239+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference top () { return c.back (); }
240+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference top () const { return c.back (); }
241241
242242 _LIBCPP_HIDE_FROM_ABI void push (const value_type& __v) { c.push_back (__v); }
243243# ifndef _LIBCPP_CXX03_LANG
Original file line number Diff line number Diff line change 1313#include < stack>
1414
1515void test () {
16- std::stack<int > stack;
17- stack.empty (); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
16+ std::stack<int > st;
17+ const std::stack<int > cst;
18+
19+ st.empty (); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
20+ st.size (); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
21+ st.top (); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
22+ cst.top (); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
1823}
You can’t perform that action at this time.
0 commit comments